diff --git a/.vsconfig b/.vsconfig new file mode 100644 index 00000000..f019fd0a --- /dev/null +++ b/.vsconfig @@ -0,0 +1,6 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.VisualStudio.Workload.ManagedGame" + ] +} diff --git a/Assets/Editor.meta b/Assets/Editor.meta new file mode 100644 index 00000000..bbeaecfd --- /dev/null +++ b/Assets/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 174488e86621bd7448c25bc9ab6eeedd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Externals/GameJam/Art/ScoreSpace.png.meta b/Assets/Externals/GameJam/Art/ScoreSpace.png.meta index 4c7d1d57..9052eca6 100644 --- a/Assets/Externals/GameJam/Art/ScoreSpace.png.meta +++ b/Assets/Externals/GameJam/Art/ScoreSpace.png.meta @@ -6,7 +6,7 @@ TextureImporter: serializedVersion: 13 mipmaps: mipMapMode: 0 - enableMipMap: 1 + enableMipMap: 0 sRGBTexture: 1 linearTexture: 0 fadeOut: 0 @@ -40,10 +40,10 @@ TextureImporter: wrapU: 0 wrapV: 0 wrapW: 0 - nPOTScale: 1 + nPOTScale: 0 lightmap: 0 compressionQuality: 50 - spriteMode: 0 + spriteMode: 1 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 @@ -52,11 +52,11 @@ TextureImporter: spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 - alphaIsTransparency: 0 + alphaIsTransparency: 1 spriteTessellationMethod: 0 spriteTessellationDetail: -1 spriteGeometrySubdivision: -1 - textureType: 0 + textureType: 8 textureShape: 1 singleChannelComponent: 0 flipbookRows: 1 @@ -95,6 +95,32 @@ TextureImporter: ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: iOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: [] @@ -102,7 +128,7 @@ TextureImporter: customData: physicsShape: [] bones: [] - spriteID: + spriteID: 5e97eb03825dee720800000000000000 internalID: 0 vertices: [] indices: diff --git a/Assets/Externals/GameJam/Orchestrator/GameAllocator.Jam.asset b/Assets/Externals/GameJam/Orchestrator/GameAllocator.Jam.asset index 94ef2b4b..b4aced7e 100644 --- a/Assets/Externals/GameJam/Orchestrator/GameAllocator.Jam.asset +++ b/Assets/Externals/GameJam/Orchestrator/GameAllocator.Jam.asset @@ -9,7 +9,8 @@ MonoBehaviour: m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1dca05c45d0b55b40bcca6a3a40fe6ea, type: 3} + m_Script: {fileID: 11500000, guid: 763a0a75464d4e21a386a5ad94ef5db8, type: 3} m_Name: GameAllocator.Jam - m_EditorClassIdentifier: PurrNet.Lobby.GenericProviders::PurrNet.Lobby.GenericProviders.P2PGameStarter - _gameScene: MainGame + m_EditorClassIdentifier: Assembly-CSharp::JamPurrTransportGameAllocator + gameScene: MainGame + useP2P: 1 diff --git a/Assets/Externals/GameJam/Orchestrator/LobbyProvider.Jam.asset b/Assets/Externals/GameJam/Orchestrator/LobbyProvider.Jam.asset index c66e56a2..77a506e1 100644 --- a/Assets/Externals/GameJam/Orchestrator/LobbyProvider.Jam.asset +++ b/Assets/Externals/GameJam/Orchestrator/LobbyProvider.Jam.asset @@ -12,4 +12,4 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 60a40bbb32e81684e9c767682ab1e745, type: 3} m_Name: LobbyProvider.Jam m_EditorClassIdentifier: PurrLobby.PurrNet::PurrLobby.PurrNet.PurrNetLobbyProvider - _maxPlayers: 8 + _maxPlayers: 9 diff --git a/Assets/Externals/GameJam/Prefabs/SessionManager Jam.prefab b/Assets/Externals/GameJam/Prefabs/SessionManager Jam.prefab index 54002636..f2f6a55d 100644 --- a/Assets/Externals/GameJam/Prefabs/SessionManager Jam.prefab +++ b/Assets/Externals/GameJam/Prefabs/SessionManager Jam.prefab @@ -66,6 +66,9 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 3820098720286823964, guid: 4550829d8e61e6042bd77dac5d1429ae, type: 3} insertIndex: 2 addedObject: {fileID: 1454789416626031383} + - targetCorrespondingSourceObject: {fileID: 3820098720286823964, guid: 4550829d8e61e6042bd77dac5d1429ae, type: 3} + insertIndex: 3 + addedObject: {fileID: 777000000000000001} m_SourcePrefab: {fileID: 100100000, guid: 4550829d8e61e6042bd77dac5d1429ae, type: 3} --- !u!1 &8731691447768879912 stripped GameObject: @@ -124,3 +127,15 @@ MonoBehaviour: maxLatency: 100 simulatePacketLoss: 0 packetLossChance: 10 +--- !u!114 &777000000000000001 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8731691447768879912} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: eebe6788196487a47bff27a2ea71eb78, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::Networking diff --git a/Assets/Externals/GameJam/Views/LobbyViewJam.prefab b/Assets/Externals/GameJam/Views/LobbyViewJam.prefab index a51b29b9..a6326837 100644 --- a/Assets/Externals/GameJam/Views/LobbyViewJam.prefab +++ b/Assets/Externals/GameJam/Views/LobbyViewJam.prefab @@ -3675,7 +3675,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7493001921848074238, guid: 264df020990aaa647b14ee2c7cbb2ae2, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -0.000030517578 objectReference: {fileID: 0} - target: {fileID: 7623610125153064757, guid: 264df020990aaa647b14ee2c7cbb2ae2, type: 3} propertyPath: m_AnchorMax.x @@ -3719,7 +3719,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 9183684759662979713, guid: 264df020990aaa647b14ee2c7cbb2ae2, type: 3} propertyPath: m_Size - value: 0.872381 + value: 0.8723809 objectReference: {fileID: 0} - target: {fileID: 9183684759662979713, guid: 264df020990aaa647b14ee2c7cbb2ae2, type: 3} propertyPath: m_Value @@ -3731,11 +3731,11 @@ PrefabInstance: objectReference: {fileID: 6696518394907344687} - target: {fileID: 9188611237920211996, guid: 264df020990aaa647b14ee2c7cbb2ae2, type: 3} propertyPath: m_Size - value: 1 + value: 0.9999999 objectReference: {fileID: 0} - target: {fileID: 9188611237920211996, guid: 264df020990aaa647b14ee2c7cbb2ae2, type: 3} propertyPath: m_Value - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: - {fileID: 4411977205756378391, guid: 264df020990aaa647b14ee2c7cbb2ae2, type: 3} @@ -6033,7 +6033,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 9183684759662979713, guid: 264df020990aaa647b14ee2c7cbb2ae2, type: 3} propertyPath: m_Value - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 9183684759662979713, guid: 264df020990aaa647b14ee2c7cbb2ae2, type: 3} propertyPath: m_TargetGraphic diff --git a/Assets/Externals/GameJam/Views/MainMenuJam.prefab b/Assets/Externals/GameJam/Views/MainMenuJam.prefab index 39dcd13b..34c19b11 100644 --- a/Assets/Externals/GameJam/Views/MainMenuJam.prefab +++ b/Assets/Externals/GameJam/Views/MainMenuJam.prefab @@ -31,12 +31,12 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 6936209515626006180} + m_Father: {fileID: 1019842361010842549} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 639.7452, y: -84} + m_SizeDelta: {x: 1239.4904, y: 128} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1452692795989568928 CanvasRenderer: @@ -531,16 +531,13 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 4855317642709679516} - {fileID: 5108561001986154504} - - {fileID: 6393524422844123731} - - {fileID: 8683750331115979637} - m_Father: {fileID: 6936209515626006180} + m_Father: {fileID: 1019842361010842549} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 639.7452, y: -38.5} + m_SizeDelta: {x: 1239.4904, y: 37} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &8515514599250246318 MonoBehaviour: @@ -601,10 +598,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 7190740501594565979} - - {fileID: 400384232050867799} - {fileID: 3676014221674271529} - - {fileID: 2544648277828187674} - {fileID: 8212785118084399108} - {fileID: 2883585108170285485} m_Father: {fileID: 1019842361010842549} @@ -743,6 +737,14 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 6936209515626006180} + - {fileID: 7190740501594565979} + - {fileID: 400384232050867799} + - {fileID: 2544648277828187674} + - {fileID: 5903894986676918972} + - {fileID: 8683750331115979637} + - {fileID: 3747032466491901315} + - {fileID: 6393524422844123731} + - {fileID: 4855317642709679516} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -992,13 +994,12 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 6161649129613658224} - - {fileID: 3747032466491901315} - m_Father: {fileID: 7190740501594565979} + m_Father: {fileID: 1019842361010842549} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 20.000015, y: -20.000015} + m_SizeDelta: {x: 32, y: 32} m_Pivot: {x: 0, y: 1} --- !u!114 &6012238853177744582 MonoBehaviour: @@ -1120,14 +1121,13 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 2177484222411551717} - - {fileID: 5903894986676918972} - {fileID: 8149860143750200926} - m_Father: {fileID: 6936209515626006180} + m_Father: {fileID: 1019842361010842549} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 639.7452, y: -335} + m_SizeDelta: {x: 1239.4904, y: 324.6667} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &969392588703132164 MonoBehaviour: @@ -1370,12 +1370,12 @@ RectTransform: - {fileID: 2762392643174722331} - {fileID: 1982942026585017506} - {fileID: 9037439220987260927} - m_Father: {fileID: 2544648277828187674} + m_Father: {fileID: 1019842361010842549} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 489.74515, y: -421} + m_SizeDelta: {x: 300, y: 172} m_Pivot: {x: 0, y: 0} --- !u!114 &2126864692386202700 MonoBehaviour: @@ -1806,7 +1806,7 @@ PrefabInstance: serializedVersion: 2 m_Modification: serializedVersion: 3 - m_TransformParent: {fileID: 7190740501594565979} + m_TransformParent: {fileID: 1019842361010842549} m_Modifications: - target: {fileID: 2241820536637779163, guid: b968de9f34a16e54e94710178af0821a, type: 3} propertyPath: _graphic @@ -1842,7 +1842,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5465661570912382580, guid: b968de9f34a16e54e94710178af0821a, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5465661570912382580, guid: b968de9f34a16e54e94710178af0821a, type: 3} propertyPath: m_AnchorMin.x @@ -1850,15 +1850,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5465661570912382580, guid: b968de9f34a16e54e94710178af0821a, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5465661570912382580, guid: b968de9f34a16e54e94710178af0821a, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 75.35 objectReference: {fileID: 0} - target: {fileID: 5465661570912382580, guid: b968de9f34a16e54e94710178af0821a, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 37 objectReference: {fileID: 0} - target: {fileID: 5465661570912382580, guid: b968de9f34a16e54e94710178af0821a, type: 3} propertyPath: m_LocalPosition.x @@ -1890,11 +1890,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5465661570912382580, guid: b968de9f34a16e54e94710178af0821a, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 1221.8153 objectReference: {fileID: 0} - target: {fileID: 5465661570912382580, guid: b968de9f34a16e54e94710178af0821a, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -38.500015 objectReference: {fileID: 0} - target: {fileID: 5465661570912382580, guid: b968de9f34a16e54e94710178af0821a, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -3362,7 +3362,7 @@ PrefabInstance: serializedVersion: 2 m_Modification: serializedVersion: 3 - m_TransformParent: {fileID: 7190740501594565979} + m_TransformParent: {fileID: 1019842361010842549} m_Modifications: - target: {fileID: 2362601747167938401, guid: 5809fb624f51eea45b9c293ea3ff56ab, type: 3} propertyPath: m_text @@ -3382,7 +3382,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3047673892661700939, guid: 5809fb624f51eea45b9c293ea3ff56ab, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3047673892661700939, guid: 5809fb624f51eea45b9c293ea3ff56ab, type: 3} propertyPath: m_AnchorMin.x @@ -3390,15 +3390,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3047673892661700939, guid: 5809fb624f51eea45b9c293ea3ff56ab, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3047673892661700939, guid: 5809fb624f51eea45b9c293ea3ff56ab, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 37 objectReference: {fileID: 0} - target: {fileID: 3047673892661700939, guid: 5809fb624f51eea45b9c293ea3ff56ab, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 37 objectReference: {fileID: 0} - target: {fileID: 3047673892661700939, guid: 5809fb624f51eea45b9c293ea3ff56ab, type: 3} propertyPath: m_LocalPosition.x @@ -3430,11 +3430,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3047673892661700939, guid: 5809fb624f51eea45b9c293ea3ff56ab, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 167.08998 objectReference: {fileID: 0} - target: {fileID: 3047673892661700939, guid: 5809fb624f51eea45b9c293ea3ff56ab, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -20.000015 objectReference: {fileID: 0} - target: {fileID: 3047673892661700939, guid: 5809fb624f51eea45b9c293ea3ff56ab, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -3799,7 +3799,7 @@ PrefabInstance: serializedVersion: 2 m_Modification: serializedVersion: 3 - m_TransformParent: {fileID: 4855317642709679516} + m_TransformParent: {fileID: 1019842361010842549} m_Modifications: - target: {fileID: 375555912367545930, guid: cde3956384d4b694a83f0fc7898d2ffd, type: 3} propertyPath: _graphic @@ -3819,7 +3819,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5040737113958996952, guid: cde3956384d4b694a83f0fc7898d2ffd, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5040737113958996952, guid: cde3956384d4b694a83f0fc7898d2ffd, type: 3} propertyPath: m_AnchorMin.x @@ -3827,15 +3827,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5040737113958996952, guid: cde3956384d4b694a83f0fc7898d2ffd, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5040737113958996952, guid: cde3956384d4b694a83f0fc7898d2ffd, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 62.09 objectReference: {fileID: 0} - target: {fileID: 5040737113958996952, guid: cde3956384d4b694a83f0fc7898d2ffd, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 16.94 objectReference: {fileID: 0} - target: {fileID: 5040737113958996952, guid: cde3956384d4b694a83f0fc7898d2ffd, type: 3} propertyPath: m_LocalPosition.x @@ -3867,11 +3867,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5040737113958996952, guid: cde3956384d4b694a83f0fc7898d2ffd, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 91.04501 objectReference: {fileID: 0} - target: {fileID: 5040737113958996952, guid: cde3956384d4b694a83f0fc7898d2ffd, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -36.000015 objectReference: {fileID: 0} - target: {fileID: 5040737113958996952, guid: cde3956384d4b694a83f0fc7898d2ffd, type: 3} propertyPath: m_LocalEulerAnglesHint.x diff --git a/Assets/Fonts.meta b/Assets/Fonts.meta new file mode 100644 index 00000000..16c7ffd4 --- /dev/null +++ b/Assets/Fonts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eaa6be5a4689d0248a8c2a5ce60b9ebf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameData.meta b/Assets/GameData.meta new file mode 100644 index 00000000..d4fc7f39 --- /dev/null +++ b/Assets/GameData.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 365da2efc5b6e5948a6f1e7bb08c890c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameData/Cases.meta b/Assets/GameData/Cases.meta new file mode 100644 index 00000000..f74b274a --- /dev/null +++ b/Assets/GameData/Cases.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2775824e9e23023428203baecd26b471 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameData/Cases/BobVsJerry.meta b/Assets/GameData/Cases/BobVsJerry.meta new file mode 100644 index 00000000..842b0290 --- /dev/null +++ b/Assets/GameData/Cases/BobVsJerry.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8d3019d8d86436243ade3aa376355111 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameData/Cases/BobVsJerry/BobVsJerry.asset b/Assets/GameData/Cases/BobVsJerry/BobVsJerry.asset new file mode 100644 index 00000000..c9373ae5 --- /dev/null +++ b/Assets/GameData/Cases/BobVsJerry/BobVsJerry.asset @@ -0,0 +1,48 @@ +%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: 5e6971ff3d637f14aabae16a22ce31d3, type: 3} + m_Name: BobVsJerry + m_EditorClassIdentifier: Assembly-CSharp::CaseData + caseName: Bob vs Jerry the Goat + caseDescription: "The Plaintiff, Bob, alleges that the Defendant, Jerry the Goat, unlawfully damaged and stole a portion of his property by eating one of the legs of Bob\u2019s wooden living room table made from mostly smoked walnut and some small amounts of oak. Bob brings this action against Jerry on the grounds of vandalism and grand theft, alleging that the value of the property consumed by Jerry exceeds $950. Jerry the Goat disputes the allegations and maintains that the table leg was a perfectly reasonable snack.\r\n" + caseAnswer: 'Guilty on the charge of vandalism ' + evidence: + - evidenceName: Evidence A + description: "Jerry\u2019s favorite food was in the 2nd floor kitchen at 5:30pm and Bob\u2019s 1st floor living room window was open from 4:00pm to 5:35pm." + image: {fileID: 0} + - evidenceName: Evidence B + description: "Jerry was out with friends from 6:00pm to 8:30pm 2 houses over, but returned to Bob\u2019s house by 8:05pm. Jerry stated that he was full and couldn\u2019t eat because he had eaten \u201Ca tasty, smoky snack\u201D" + image: {fileID: 0} + - evidenceName: Evidence C + description: "Jerry\u2019s favorite food is a full chicken that has been roasted and grilled with smoked hickory.\r\n" + image: {fileID: 0} + - evidenceName: Evidence D + description: 'Bob purchased the table for $1,240 about six months before the incident. The table was made mostly of smoked walnut wood. According to the receipt, each individual table leg was valued at approximately $210 for repair. + +' + image: {fileID: 0} + - evidenceName: Evidence E + description: 'At 5:17pm, Bob''s neighbor, Mrs. Bobderson, heard what she described as a "large cracking sound" coming from Bob''s house. About one minute later, she saw Jerry the Goat standing outside Bob''s living room window with a piece of dark-colored material in his mouth. + +' + image: {fileID: 0} + - evidenceName: Evidence F + description: 'A manufacturers guide from Suspicious Wood & Co states that the table legs were made from oak. + +' + image: {fileID: 0} + - evidenceName: Evidence G + description: "The bowl containing Jerry\u2019s favorite food was found broken on the countertop. The chicken appeared smashed, leaving it impossible to tell if it was eaten or not.\r\n" + image: {fileID: 0} + - evidenceName: Evidence H + description: + image: {fileID: 5896200882139721795, guid: b61f46a65bc965246893cd0626d989b7, type: 3} diff --git a/Assets/GameData/Cases/BobVsJerry/BobVsJerry.asset.meta b/Assets/GameData/Cases/BobVsJerry/BobVsJerry.asset.meta new file mode 100644 index 00000000..6958c14a --- /dev/null +++ b/Assets/GameData/Cases/BobVsJerry/BobVsJerry.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7efc165dd1a540e4e87045b585daa205 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameData/Cases/BobVsJerry/Images.meta b/Assets/GameData/Cases/BobVsJerry/Images.meta new file mode 100644 index 00000000..02cc94f6 --- /dev/null +++ b/Assets/GameData/Cases/BobVsJerry/Images.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e89b55bba6c43a14bae62951ef39b389 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameData/Cases/BobVsJerry/Images/evidence8.png b/Assets/GameData/Cases/BobVsJerry/Images/evidence8.png new file mode 100644 index 00000000..442f352d Binary files /dev/null and b/Assets/GameData/Cases/BobVsJerry/Images/evidence8.png differ diff --git a/Assets/GameData/Cases/BobVsJerry/Images/evidence8.png.meta b/Assets/GameData/Cases/BobVsJerry/Images/evidence8.png.meta new file mode 100644 index 00000000..c2bdbcb4 --- /dev/null +++ b/Assets/GameData/Cases/BobVsJerry/Images/evidence8.png.meta @@ -0,0 +1,158 @@ +fileFormatVersion: 2 +guid: b61f46a65bc965246893cd0626d989b7 +TextureImporter: + internalIDToNameTable: + - first: + 213: 5896200882139721795 + second: Screenshot 2026-09-13 195707_0 + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + 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: 1 + spriteTessellationMethod: 0 + spriteTessellationDetail: -1 + spriteGeometrySubdivision: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: Screenshot 2026-09-13 195707_0 + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 255 + height: 258 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + customData: + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 3407840867383d150800000000000000 + internalID: 5896200882139721795 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: + Screenshot 2026-09-13 195707_0: 5896200882139721795 + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameData/Cases/TheStateOfMontanaVsJosephCabral.meta b/Assets/GameData/Cases/TheStateOfMontanaVsJosephCabral.meta new file mode 100644 index 00000000..e487ac67 --- /dev/null +++ b/Assets/GameData/Cases/TheStateOfMontanaVsJosephCabral.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7f69716263b794440a65d8412866f8a5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameData/Cases/TheStateOfMontanaVsJosephCabral/theStateOfMontanaVsJosephCabral.asset b/Assets/GameData/Cases/TheStateOfMontanaVsJosephCabral/theStateOfMontanaVsJosephCabral.asset new file mode 100644 index 00000000..76b78a8f --- /dev/null +++ b/Assets/GameData/Cases/TheStateOfMontanaVsJosephCabral/theStateOfMontanaVsJosephCabral.asset @@ -0,0 +1,56 @@ +%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: 5e6971ff3d637f14aabae16a22ce31d3, type: 3} + m_Name: theStateOfMontanaVsJosephCabral + m_EditorClassIdentifier: Assembly-CSharp::CaseData + caseName: 'The State of Montana vs Joseph Cabral ' + caseDescription: "\tThe Prosecution, The State Of Montana, alleges that the Defendant, Joseph Cabral, attempted to cause the destruction of a military radio tower with smuggled bombs. The State Of Montana brings this action against Joseph Cabral on the grounds of Destruction of Government Property and Use of a Weapon of Mass Destruction, alleging that Cabral knowingly transported and deployed explosive devices with the intent to damage a facility operated by the United States military. Joseph Cabral disputes the allegations and maintains that he was acting under orders from a government contractor and therefore reasonably believed that his actions were authorized.\r\n" + caseAnswer: 'Guilty on the charge of Use of a Weapon of Mass Destruction ' + evidence: + - evidenceName: Evidence A + description: 'A signed contract between Joseph Cabral and Blackridge Defense Solutions authorizes Cabral to "neutralize and permanently disable" the Montana military radio tower. The contract does not specify a particular method for accomplishing the objective. + +' + image: {fileID: 0} + - evidenceName: Evidence B + description: 'A military report classifies the radio tower as a Category IV Communications Installation. The report states that the facility is considered strategically important but contains no information regarding the methods authorized for its destruction. + +' + image: {fileID: 0} + - evidenceName: Evidence C + description: 'A weapons technician examining material recovered from the incident reported that it contained an unusual radioactive substance. The technician testified that the material could be dangerous if sufficiently dispersed, but could not determine from the recovered fragments exactly how Cabral intended to use it. + +' + image: {fileID: 0} + - evidenceName: Evidence D + description: Blackridge Defense Solutions provided Cabral with a non-exhaustive list of equipment commonly used for operations involving the destruction of military infrastructure. The list includes several types of explosives, electronic equipment, and specialized demolition tools. Cabral's recovered equipment does not completely match the items on the list. + image: {fileID: 0} + - evidenceName: Evidence E + description: 'A shipping manifest identifies Joseph Cabral as the recipient of a crate labeled "Industrial Communications Equipment, Non-Hazardous." The crate was later discovered to have contained material associated with the explosive device. The manifest does not identify who packed or labeled the crate. + +' + image: {fileID: 0} + - evidenceName: Evidence F + description: 'An internal Blackridge memo states that Cabral was given a high level of discretion over the equipment used during the operation. Another section of the same memo states that contractors were expected to follow all applicable weapons regulations and company safety procedures unless in an emergency situation. + +' + image: {fileID: 0} + - evidenceName: Evidence G + description: 'A copy of Cabral''s contract contains a clause stating that he would not be held responsible for "reasonable operational decisions made in pursuit of the assigned objective." Blackridge Defense Solutions representatives later testified that the clause was intended to protect contractors from liability for ordinary equipment failures and unexpected circumstances. + +' + image: {fileID: 0} + - evidenceName: Evidence H + description: 'Forensic analysis determined that the recovered device was capable of dispersing radioactive material over a considerably larger area than would normally be necessary to damage the radio tower. The analyst could not determine from the remains whether this capability was intentional or simply a consequence of the device''s design. + +' + image: {fileID: 0} diff --git a/Assets/GameData/Cases/TheStateOfMontanaVsJosephCabral/theStateOfMontanaVsJosephCabral.asset.meta b/Assets/GameData/Cases/TheStateOfMontanaVsJosephCabral/theStateOfMontanaVsJosephCabral.asset.meta new file mode 100644 index 00000000..003b2b67 --- /dev/null +++ b/Assets/GameData/Cases/TheStateOfMontanaVsJosephCabral/theStateOfMontanaVsJosephCabral.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 55e8263dcb834784dbd17e72f8dcd540 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100644 index 00000000..b91860c3 --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fc6eebd3324e8a1499f47d80499c7123 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader.meta b/Assets/Plugins/AllIn1SpriteShader.meta new file mode 100644 index 00000000..6c140a29 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 151483ddcae0bba4da530432cab5e818 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef b/Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef new file mode 100644 index 00000000..80a821f4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef @@ -0,0 +1,17 @@ +{ + "name": "AllIn1SpriteShaderAssembly", + "rootNamespace": "", + "references": [ + "GUID:7ab3663edede26740845931880bf22af", + "GUID:75469ad4d38634e559750d17036d5f7c" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef.meta b/Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef.meta new file mode 100644 index 00000000..f2fccb67 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 91de482a0a233614ab5962ea5f6c24ee +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/AllIn1SpriteShaderAssembly.asmdef + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo.meta b/Assets/Plugins/AllIn1SpriteShader/Demo.meta new file mode 100644 index 00000000..d4fbf709 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8547c35f10eb6ad4697607cdde60ad3c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation.meta new file mode 100644 index 00000000..82104370 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5dda08a101e9e6f4eb3bc2eaac144b3f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller new file mode 100644 index 00000000..adf4799a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Alpha Cutoff + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 6467778131688425141} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &3664986056586936730 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AlphaCutoff + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 2b4fb9dc8c60f4149a1699d21550ad74, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &6467778131688425141 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 3664986056586936730} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 3664986056586936730} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller.meta new file mode 100644 index 00000000..6c2d308b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d7d72c9f17b0ebe4e908dab552b82c45 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Alpha Cutoff.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim new file mode 100644 index 00000000..626c019a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AlphaCutoff + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0.98 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._AlphaCutoffValue + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2296261589 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.6666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0.98 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._AlphaCutoffValue + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim.meta new file mode 100644 index 00000000..8424ea64 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2b4fb9dc8c60f4149a1699d21550ad74 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AlphaCutoff.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller new file mode 100644 index 00000000..b8bf9af4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-7096875646415134801 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ShinyBoy + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 025b58e8824357d47bc58c069785117d, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AtlasSpriteBoy + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 4058490066961251321} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &4058490066961251321 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -7096875646415134801} + m_Position: {x: 260, y: 60, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -7096875646415134801} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller.meta new file mode 100644 index 00000000..4a76fe6a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8652a2e9bd26fdf45b91d4e790b17cb1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/AtlasSpriteBoy.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim new file mode 100644 index 00000000..344bd58a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Blur + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 18.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._BlurIntensity + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2150532686 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.6666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 18.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._BlurIntensity + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim.meta new file mode 100644 index 00000000..ccdabb69 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c5d41ccefede6154f8ae605173ef7ff2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller new file mode 100644 index 00000000..5e68654b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-8834132420444968739 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 7853909571706163922} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 7853909571706163922} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Blur + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -8834132420444968739} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &7853909571706163922 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Blur + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: c5d41ccefede6154f8ae605173ef7ff2, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller.meta new file mode 100644 index 00000000..106ae974 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4d13c3a68decb714e80835bb34f348f3 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Blur.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim new file mode 100644 index 00000000..2150839b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim @@ -0,0 +1,233 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Burn + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.26666668 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.43333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectBlend + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.1 + value: 0 + inSlope: 0.36363637 + outSlope: 0.36363637 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2333048903 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2375902170 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.26666668 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.43333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectBlend + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.1 + value: 0 + inSlope: 0.36363637 + outSlope: 0.36363637 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim.meta new file mode 100644 index 00000000..907142ed --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d67d27ddcf1126d4189d14140cc10cbc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller new file mode 100644 index 00000000..a503dda1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Burn + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 5582001109422249166} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &3750917721442123826 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Burn + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: d67d27ddcf1126d4189d14140cc10cbc, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &5582001109422249166 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 3750917721442123826} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 3750917721442123826} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller.meta new file mode 100644 index 00000000..3e035cf2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 9d3bba413d0ce9244b743d634f8d3c27 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Burn.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim new file mode 100644 index 00000000..0ca7c221 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim @@ -0,0 +1,332 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BurningSoldier + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 24.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 35.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 15.9 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 30.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 26.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 41.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 31.1 + inSlope: -56.699993 + outSlope: -56.699993 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 22.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 31 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.6666666 + value: 27.5 + inSlope: -41.999996 + outSlope: -41.999996 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.8333334 + value: 16.8 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 34.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.1666667 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Glow + path: Burn + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 4116755002 + attribute: 2271964720 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 2.1666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 24.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 35.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 15.9 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 30.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 26.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 41.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 31.1 + inSlope: -56.699993 + outSlope: -56.699993 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 22.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 31 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.6666666 + value: 27.5 + inSlope: -41.999996 + outSlope: -41.999996 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.8333334 + value: 16.8 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 34.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.1666667 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Glow + path: Burn + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim.meta new file mode 100644 index 00000000..d6db4643 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3f0612e16135f2c4896bf79e439c17b8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller new file mode 100644 index 00000000..f9a584bd --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BurningSoldier + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 8782918891389931882} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &8782918891389931882 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 9025100736644353693} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 9025100736644353693} +--- !u!1102 &9025100736644353693 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BurningSoldier + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 3f0612e16135f2c4896bf79e439c17b8, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller.meta new file mode 100644 index 00000000..c7128ba7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 5f3b82f530c24dd48961a1d428ed91d8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/BurningSoldier.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim new file mode 100644 index 00000000..0f3ea044 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim @@ -0,0 +1,395 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CrazyPattern + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.25 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.6666666 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.0833333 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 6.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RotateUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.25 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.6666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.0833333 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.9166667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 3.3333333 + value: 0.00908789 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2278947341 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2301463249 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 3.3333333 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.25 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.6666666 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.0833333 + value: 3.1416 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 6.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RotateUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.25 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.6666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.0833333 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.9166667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 3.3333333 + value: 0.00908789 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim.meta new file mode 100644 index 00000000..3caf6991 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ad92dfbcd615b014a935ff2405b31f9d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller new file mode 100644 index 00000000..4bb3001c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CrazyPattern + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 1107734427540884016} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &1102331061419599162 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CrazyPattern + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: ad92dfbcd615b014a935ff2405b31f9d, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &1107734427540884016 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 1102331061419599162} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 1102331061419599162} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller.meta new file mode 100644 index 00000000..8b156254 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f994ff75b3f33ae46af22e6462b4606a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CrazyPattern.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim new file mode 100644 index 00000000..eeb47fbb --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CustomGradient + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.52 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.75 + value: 0.52 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: -0.52 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ColorRampLuminosity + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2233840366 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.5 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.52 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.75 + value: 0.52 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: -0.52 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ColorRampLuminosity + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim.meta new file mode 100644 index 00000000..b7d6e284 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7f6e7a4a06cb0ed46bed4c808d5ef0fc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller new file mode 100644 index 00000000..e6f3cc1a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CustomGradient + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 1107173670123172324} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &1102237943875058834 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CustomGradient + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 7f6e7a4a06cb0ed46bed4c808d5ef0fc, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &1107173670123172324 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 1102237943875058834} + m_Position: {x: 384, y: 73, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 1102237943875058834} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller.meta new file mode 100644 index 00000000..18f0088b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: edeeb31731bec5f4092bbc3bbff03e91 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/CustomGradient.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim new file mode 100644 index 00000000..fe67793c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim @@ -0,0 +1,251 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Fade + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.9166667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 13.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeBurnGlow + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2375902170 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2407006466 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.9166667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 13.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeBurnGlow + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim.meta new file mode 100644 index 00000000..4faed61e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e6ea2b9990f282841809c38407852410 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller new file mode 100644 index 00000000..ed6316ac --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Fade + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 5715813001965171755} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &335997213937709296 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Fade + m_Speed: 0.25 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: e6ea2b9990f282841809c38407852410, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &5715813001965171755 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 335997213937709296} + m_Position: {x: 252, y: 48, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 335997213937709296} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller.meta new file mode 100644 index 00000000..d76c273a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2025469cc6b8be543a1b93993e746b75 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fade.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller new file mode 100644 index 00000000..5fd23330 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller @@ -0,0 +1,147 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-7387446859746230137 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TeleportReverse + m_Speed: -1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: -7156134355841481533} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: d55cd89bba47b6c4dbfe242daad46b9e, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &-7264864826306982476 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 542486197727019260} + m_Position: {x: 290, y: 110, z: 0} + - serializedVersion: 1 + m_State: {fileID: -7387446859746230137} + m_Position: {x: 290, y: 20, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 542486197727019260} +--- !u!1101 &-7156134355841481533 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 542486197727019260} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 1 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &-6218460184888794421 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -7387446859746230137} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 1 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Fill Amount 1 + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -7264864826306982476} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &542486197727019260 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Teleport + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: -6218460184888794421} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: d55cd89bba47b6c4dbfe242daad46b9e, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller.meta new file mode 100644 index 00000000..335584b8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2cd3280111dab4e41ba2dd630db17ca4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount 1.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller new file mode 100644 index 00000000..4199ee3b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-8956218147619503351 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: FillAmount + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 96ea5fb127ca6e34e8f61e91018c6e1b, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &-2648066226161793259 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -8956218147619503351} + m_Position: {x: 260, y: 60, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -8956218147619503351} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Fill Amount + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -2648066226161793259} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller.meta new file mode 100644 index 00000000..e04e6c6a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6078cf4809fc6174f90700135dcf328f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fill Amount.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim new file mode 100644 index 00000000..57c80d1d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: FillAmount + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.44444445 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8888889 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ClipUvRight + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 45 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2187639724 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.8888889 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.44444445 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8888889 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ClipUvRight + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim.meta new file mode 100644 index 00000000..eef15616 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 96ea5fb127ca6e34e8f61e91018c6e1b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/FillAmount.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller new file mode 100644 index 00000000..1f611148 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller @@ -0,0 +1,101 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-1965812634030799034 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 7173216993388856439} + m_Position: {x: 200, y: 0, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102029001882399030} + m_Position: {x: 235, y: 65, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 7173216993388856439} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Fish Eye + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -1965812634030799034} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &1102029001882399030 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CustomGradient + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 7f6e7a4a06cb0ed46bed4c808d5ef0fc, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &7173216993388856439 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Hallucination + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 8186e6a2d59204e4283c29e5abfedb85, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller.meta new file mode 100644 index 00000000..b3313043 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 009a1cbada3894e4387ecb3a8a39e335 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Fish Eye.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller new file mode 100644 index 00000000..87ba4681 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-9028953883465965845 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: hpBar + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 6183fddabf104ce47abe341327074864, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &-8663805930458218728 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -9028953883465965845} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -9028953883465965845} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Frame + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -8663805930458218728} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller.meta new file mode 100644 index 00000000..aa1435a4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f36bce3b3e7e3c5488117e16e426deb5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Frame.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim new file mode 100644 index 00000000..71da56f2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Hallucination + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.7777778 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5555556 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HsvShift + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 45 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2206827623 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.5555556 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.7777778 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5555556 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HsvShift + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim.meta new file mode 100644 index 00000000..dc46a50b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8186e6a2d59204e4283c29e5abfedb85 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hallucination.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller new file mode 100644 index 00000000..4a6490eb --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-3029259370103312344 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 1169743166369495606} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 1169743166369495606} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Hit Effect 1 + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -3029259370103312344} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &1169743166369495606 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Rotate + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: a3c9d77a6b2549c4d8ae31057eca0fc9, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller.meta new file mode 100644 index 00000000..de8218f0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1cc6e3c6540cce34bb2f509398f90917 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect 1.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller new file mode 100644 index 00000000..61fc3e39 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-5913550154835270090 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: HitEffect + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 769de38e4feb31b429ee5eb7b5bece71, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Hit Effect + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 4195058999054830920} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &4195058999054830920 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -5913550154835270090} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -5913550154835270090} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller.meta new file mode 100644 index 00000000..75a2e2d3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c6e411a605ec50345a36bbab9d3cc722 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hit Effect.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim new file mode 100644 index 00000000..c3316c02 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: HitEffect + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectBlend + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2333048903 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.6666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectBlend + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim.meta new file mode 100644 index 00000000..7f4a3fe8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 769de38e4feb31b429ee5eb7b5bece71 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/HitEffect.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim new file mode 100644 index 00000000..9c6607c0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim @@ -0,0 +1,323 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Hologram + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0.613 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.45 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5833334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ChromAberrAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0.359 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 0.359 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.45 + value: 0.35901853 + inSlope: 0.0002965927 + outSlope: 0.0002965927 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5833334 + value: 0.37623176 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ChromAberrAlpha + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2187965785 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2229035585 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.5833334 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0.613 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.45 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5833334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ChromAberrAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.4 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0.359 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 0.359 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.45 + value: 0.35901853 + inSlope: 0.0002965927 + outSlope: 0.0002965927 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5833334 + value: 0.37623176 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ChromAberrAlpha + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim.meta new file mode 100644 index 00000000..c49e160e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2d06614560bbcda488c23b8708ff4c49 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Hologram.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim new file mode 100644 index 00000000..a9ac4495 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim @@ -0,0 +1,278 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: IceSoldier + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 3 + value: 0.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Glow + path: Ice + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.75 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: Ice + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 3 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: SnowFlakesPS + classID: 1 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 4077044462 + attribute: 2271964720 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 4077044462 + attribute: 2375902170 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 444922166 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 3 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 3 + value: 0.6 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Glow + path: Ice + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.75 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: Ice + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 3 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: SnowFlakesPS + classID: 1 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim.meta new file mode 100644 index 00000000..2a5ae87e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f8f2d0809b870954c850e5004e9b4f67 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller new file mode 100644 index 00000000..302853e1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-1136635573635380662 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 7920773727163540604} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 7920773727163540604} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: IceSoldier + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -1136635573635380662} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &7920773727163540604 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: IceSoldier + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: f8f2d0809b870954c850e5004e9b4f67, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller.meta new file mode 100644 index 00000000..edbe26e6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c2df20f2d12e21b46bacd5dfa839b92e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/IceSoldier.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller new file mode 100644 index 00000000..4dd9e9ea --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Impact + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 2011205658823687596} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &2011205658823687596 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 2695582658214874718} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 2695582658214874718} +--- !u!1102 &2695582658214874718 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Impact1 + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: b4a017fddcef25548ad4089f01c9da55, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller.meta new file mode 100644 index 00000000..23c8939a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a1097444efe6cb54f86e2955982c0fe1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim new file mode 100644 index 00000000..3c766ec6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim @@ -0,0 +1,737 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Impact1 + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ChromAberrAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0.245 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FishEyeUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 0.155 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectBlend + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.r + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.9980566 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.g + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.9381551 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0.3443396 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.b + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.a + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2187965785 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2296652321 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2301463249 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2333048903 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 1455733126 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 1724168582 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 1187297670 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 1992604038 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ChromAberrAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0.245 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FishEyeUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 0.155 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectBlend + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.r + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.9980566 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.g + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.9381551 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 0.3443396 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.b + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.51666665 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HitEffectColor.a + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim.meta new file mode 100644 index 00000000..7fb7bb14 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b4a017fddcef25548ad4089f01c9da55 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Impact1.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim new file mode 100644 index 00000000..3e5e8a38 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim @@ -0,0 +1,322 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: MotionBlur + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: -2.59, y: 0, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.33333334 + value: {x: -2.59, y: 0, z: 0} + inSlope: {x: -0, y: 0, z: 0} + outSlope: {x: 13.684616, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.76666665 + value: {x: 3.34, y: 0, z: 0} + inSlope: {x: 13.684616, y: 0, z: 0} + outSlope: {x: -7.803249, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.35 + value: 2.43 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 2.33 + inSlope: -0.9600014 + outSlope: -0.9600014 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.76666665 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MotionBlurDist + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2244204413 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.76666665 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -2.59 + inSlope: 0 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: -2.59 + inSlope: -0 + outSlope: 13.684616 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.76666665 + value: 3.34 + inSlope: 13.684616 + outSlope: -7.803249 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.76666665 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.76666665 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.35 + value: 2.43 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 2.33 + inSlope: -0.9600014 + outSlope: -0.9600014 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.76666665 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MotionBlurDist + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 1 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim.meta new file mode 100644 index 00000000..fcb579e9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e618782845320624bb758db2d2b9bf0e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/MotionBlur.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim new file mode 100644 index 00000000..1387133d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Offset + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.104 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: -0.104 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0.104 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._OffsetUvX + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2328359666 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.6666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.104 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: -0.104 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0.104 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._OffsetUvX + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim.meta new file mode 100644 index 00000000..fb4e7235 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: cfa3188cad768364993a043c85b5add0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller new file mode 100644 index 00000000..b9a8d8d0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-5873563199590618010 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Offset + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: cfa3188cad768364993a043c85b5add0, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Offset + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 5176085075958421900} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &5176085075958421900 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -5873563199590618010} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -5873563199590618010} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller.meta new file mode 100644 index 00000000..c87aa71a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 63273b05c4774384b85a146feb6df4d3 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Offset.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller new file mode 100644 index 00000000..8b751079 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-7075512637821731064 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -2683493651811674534} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -2683493651811674534} +--- !u!1102 &-2683493651811674534 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Hologram + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 2d06614560bbcda488c23b8708ff4c49, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Original + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -7075512637821731064} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller.meta new file mode 100644 index 00000000..9f5ffab6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ad5ae64e9a03a1a40889385b2d0f2b89 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Original.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim new file mode 100644 index 00000000..7309422a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Posterize + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 6 + inSlope: 0 + outSlope: 8 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 10 + inSlope: 8 + outSlope: -8 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 6 + inSlope: -8 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PosterizeNumColors + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2351287835 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 6 + inSlope: 0 + outSlope: 8 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 10 + inSlope: 8 + outSlope: -8 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 6 + inSlope: -8 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PosterizeNumColors + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim.meta new file mode 100644 index 00000000..3ded46cb --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 82ee3808b395730498f393a00662e41a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller new file mode 100644 index 00000000..027f689f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-8832860468942279513 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -5881428344133791977} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -5881428344133791977} +--- !u!1102 &-5881428344133791977 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Posterize + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 82ee3808b395730498f393a00662e41a, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Posterize + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -8832860468942279513} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller.meta new file mode 100644 index 00000000..0ea0c31b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e25fb0db751a59a43bb4bd01628feb7e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Posterize.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim new file mode 100644 index 00000000..1929a1fa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RadialFillAmount + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RadialClip2 + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2304530698 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RadialClip2 + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim.meta new file mode 100644 index 00000000..86e3f3c0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fee541ce475b5ae4c9d0ddad66e4d464 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller new file mode 100644 index 00000000..35fbd00a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-2648066226161793259 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 1102919259890989908} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 1102919259890989908} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RadialFillAmount + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -2648066226161793259} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &1102919259890989908 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RadialFillAmount + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: fee541ce475b5ae4c9d0ddad66e4d464, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller.meta new file mode 100644 index 00000000..022e3ca7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f325edee1e9fb044eb0d87aad6d3ece0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/RadialFillAmount.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim new file mode 100644 index 00000000..573f40ea --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim @@ -0,0 +1,116 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Rotate + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 18.84 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 6.28 + inSlope: 18.84 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RotateUvAmount + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2278947341 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.33333334 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 18.84 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 6.28 + inSlope: 18.84 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RotateUvAmount + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim.meta new file mode 100644 index 00000000..dc866839 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a3c9d77a6b2549c4d8ae31057eca0fc9 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller new file mode 100644 index 00000000..2c5a9e24 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-3120651885421920482 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Rotate + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: a3c9d77a6b2549c4d8ae31057eca0fc9, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Rotate + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 2449547186783014002} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &2449547186783014002 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -3120651885421920482} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -3120651885421920482} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller.meta new file mode 100644 index 00000000..e12d11c4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1243dd8a666ff6b4787a02084a5170d1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Rotate.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim new file mode 100644 index 00000000..3c95cfe1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ScreenHit + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Alpha + path: HitSprite + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 3618885906 + attribute: 2333735666 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Alpha + path: HitSprite + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim.meta new file mode 100644 index 00000000..5b3f0514 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0f35df6c475fd3a47a801523e733c87a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller new file mode 100644 index 00000000..216b7f70 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-5761580113761073130 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ScreenHit + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 0f35df6c475fd3a47a801523e733c87a, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ScreenHit + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 4855511007839786432} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &4855511007839786432 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -5761580113761073130} + m_Position: {x: 216, y: 48, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -5761580113761073130} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller.meta new file mode 100644 index 00000000..e5f3f2e1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1220612ba20667d46a6e8356073b69b0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ScreenHit.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller new file mode 100644 index 00000000..b386d685 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-4642615002787253909 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 392135796101470953} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 392135796101470953} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Shield Soldier + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -4642615002787253909} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &392135796101470953 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ShieldSparksPS + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 4f4343d48a0bd474fa2c4abc51d18cc1, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller.meta new file mode 100644 index 00000000..fca39ce7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 48122208e82681f45a0f7dda84aa301f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shield Soldier.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim new file mode 100644 index 00000000..d40b8a5a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim @@ -0,0 +1,601 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ShieldSparksPS + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: -0.058, y: -1.801, z: -0.1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.5 + value: {x: -0.058, y: 1.878, z: -0.1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.53333336 + value: {x: -0.058, y: 1.878, z: -0.1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 1.4833333 + value: {x: -0.058, y: 1.8665462, z: -0.1} + inSlope: {x: 0, y: -0.0022222255, z: 0} + outSlope: {x: 0, y: -0.0022222255, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 1.5 + value: {x: -0.058, y: 1.8660091, z: -0.1} + inSlope: {x: 0, y: -0.004157712, z: 0} + outSlope: {x: 0, y: -0.004157712, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 2 + value: {x: -0.058, y: -1.78, z: -0.1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 2.5 + value: {x: -0.058, y: 1.8660091, z: -0.1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: ShieldSparksPS + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: Shield + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.53333336 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: EmissionModule.rateOverTime.scalar + path: ShieldSparksPS + classID: 198 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 88045128 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 423614430 + attribute: 2375902170 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 88045128 + attribute: 2883525743 + script: {fileID: 0} + typeID: 198 + customType: 27 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 2.5 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: Shield + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.53333336 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: -0.058 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: ShieldSparksPS + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -1.801 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 1.878 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.53333336 + value: 1.878 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 1.8665462 + inSlope: -0.0022222255 + outSlope: -0.0022222255 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 1.8660091 + inSlope: -0.004157712 + outSlope: -0.004157712 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: -1.78 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 1.8660091 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: ShieldSparksPS + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.53333336 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: ShieldSparksPS + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.53333336 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 30 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: EmissionModule.rateOverTime.scalar + path: ShieldSparksPS + classID: 198 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim.meta new file mode 100644 index 00000000..935ebc6b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4f4343d48a0bd474fa2c4abc51d18cc1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShieldSparksPS.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim new file mode 100644 index 00000000..756ae352 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim @@ -0,0 +1,152 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Shine + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ShineLocation + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2326997892 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.5 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8333333 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ShineLocation + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim.meta new file mode 100644 index 00000000..70e6f909 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a5367530cc5998b4ea48fb27bde9ad47 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller new file mode 100644 index 00000000..e6abbcc0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-8306752329881989475 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 7241695106506440127} + m_Position: {x: 280, y: 80, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 7241695106506440127} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Shine + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -8306752329881989475} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &7241695106506440127 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Shine + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: a5367530cc5998b4ea48fb27bde9ad47, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller.meta new file mode 100644 index 00000000..3191b1a1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1b6613bf9b3fea94380070ae23178552 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Shine.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim new file mode 100644 index 00000000..7057cf50 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim @@ -0,0 +1,179 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: ShinyBoy + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 360 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 360 + inSlope: 360 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HsvShift + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ShineLocation + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 30 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2206827623 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2326997892 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 360 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 360 + inSlope: 360 + outSlope: 0 + tangentMode: 69 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HsvShift + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ShineLocation + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim.meta new file mode 100644 index 00000000..62f42b30 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 025b58e8824357d47bc58c069785117d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/ShinyBoy.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller new file mode 100644 index 00000000..618363fb --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-7618782969959717699 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -4193363627458388406} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -4193363627458388406} +--- !u!1102 &-4193363627458388406 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: SoldierRun + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: f66460fd2ad94fc48953b837ae43d577, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Soldier + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -7618782969959717699} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller.meta new file mode 100644 index 00000000..aca7300b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2f06abfb8d5c7014299913ef4dbc450d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Soldier.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim new file mode 100644 index 00000000..6c1a89f6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim @@ -0,0 +1,458 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: SoldierRun + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: -0.075 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._OffsetUvY + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.x + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 1.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.y + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.z + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.w + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2378220132 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 377931145 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 109495689 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 646366601 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 914802057 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.16666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: -0.075 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._OffsetUvY + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.x + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 1.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.y + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.z + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.083333336 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.16666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._MainTex_ST.w + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim.meta new file mode 100644 index 00000000..d5402c19 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f66460fd2ad94fc48953b837ae43d577 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/SoldierRun.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller new file mode 100644 index 00000000..a5687d37 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-3627288444216986430 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: MotionBlur + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: e618782845320624bb758db2d2b9bf0e, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &-2709104361246388160 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -3627288444216986430} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -3627288444216986430} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Sprite + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -2709104361246388160} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller.meta new file mode 100644 index 00000000..62709279 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 33212171a9274b947914d32a914af1a3 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Sprite.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim new file mode 100644 index 00000000..80b911b7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim @@ -0,0 +1,215 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Teleport + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.85 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.85 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 100 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2301463249 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2375902170 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.85 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.85 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.85 + value: -0.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._FadeAmount + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim.meta new file mode 100644 index 00000000..4ab8d242 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d55cd89bba47b6c4dbfe242daad46b9e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Teleport.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller new file mode 100644 index 00000000..b4206560 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller @@ -0,0 +1,147 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-7822484566270033091 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TwistDisappearInverse + m_Speed: -1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: 4044203229998360206} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 0b970b1c29876434a90d1b416c2a79da, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1101 &-5714200180160972232 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -7822484566270033091} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 1 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &-2059169651024962981 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TwistDisappear + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: -5714200180160972232} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 0b970b1c29876434a90d1b416c2a79da, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Twist 1 + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 7170545140116765573} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1101 &4044203229998360206 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -2059169651024962981} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 1 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1107 &7170545140116765573 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -2059169651024962981} + m_Position: {x: 330, y: 100, z: 0} + - serializedVersion: 1 + m_State: {fileID: -7822484566270033091} + m_Position: {x: 330, y: 30, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -2059169651024962981} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller.meta new file mode 100644 index 00000000..ed3617d8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: fe198228e3a49df4b966ab214ec9cde5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist 1.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim new file mode 100644 index 00000000..5b4946ee --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Twist + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 1.56 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._TwistUvAmount + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 40 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2296183723 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 1.56 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._TwistUvAmount + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim.meta new file mode 100644 index 00000000..56f01f77 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4d7af8b9ba927a74ca451c409cb63239 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller new file mode 100644 index 00000000..0f365ff2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-94178637910970603 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 7878794423122388568} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 7878794423122388568} +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Twist + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: -94178637910970603} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &7878794423122388568 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Twist + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 4d7af8b9ba927a74ca451c409cb63239, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller.meta new file mode 100644 index 00000000..3dbda538 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: ed827ed402dcef3458313b21158b5c7c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Twist.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim new file mode 100644 index 00000000..f546044d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim @@ -0,0 +1,647 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TwistDisappear + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 6.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 6.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RotateUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 1.58 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 1.58 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._TwistUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Alpha + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Glow + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HsvShift + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2278947341 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2296183723 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2301463249 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2333735666 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2271964720 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 2206827623 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.4833333 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 6.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 6.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._RotateUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 1.58 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 1.58 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._TwistUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._PinchUvAmount + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Alpha + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._Glow + path: + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.41666666 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.1666666 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.4833333 + value: 360 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._HsvShift + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim.meta new file mode 100644 index 00000000..d36ff0b1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 0b970b1c29876434a90d1b416c2a79da +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/TwistDisappear.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim new file mode 100644 index 00000000..3f8e6974 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Zoom + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.87 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0.21 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0.87 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ZoomUvAmount + path: + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 2208268607 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.6666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.87 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0.21 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.6666667 + value: 0.87 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ZoomUvAmount + path: + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim.meta new file mode 100644 index 00000000..52167093 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 609d80679704fe540a7be47d8ddd8eef +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller new file mode 100644 index 00000000..f2c1c042 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-1086332058936838499 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Zoom + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 609d80679704fe540a7be47d8ddd8eef, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Zoom + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 8956640337037327091} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &8956640337037327091 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -1086332058936838499} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -1086332058936838499} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller.meta new file mode 100644 index 00000000..283f98bc --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f63147b3bd9ae6949be2ad05c6679dd5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/Zoom.controller + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim new file mode 100644 index 00000000..f1eb29ea --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: hpBar + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ClipUvRight + path: Front + classID: 212 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 1060785650 + attribute: 2187639724 + script: {fileID: 0} + typeID: 212 + customType: 22 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: material._ClipUvRight + path: Front + classID: 212 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim.meta new file mode 100644 index 00000000..ff52059c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 6183fddabf104ce47abe341327074864 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Animation/hpBar.anim + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity new file mode 100644 index 00000000..df067ef8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity @@ -0,0 +1,59103 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 512 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 4890085278179872738, guid: 04e4e245768314d4289c0cb228552142, + type: 2} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!21 &7746739 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.016 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &14374124 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 14374125} + - component: {fileID: 14374127} + - component: {fileID: 14374126} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &14374125 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 14374124} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 290590332} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &14374126 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 14374124} + m_Text: Regular Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &14374127 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 14374124} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &42135249 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 42135250} + - component: {fileID: 42135253} + - component: {fileID: 42135252} + m_Layer: 0 + m_Name: SpookySoldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &42135250 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 42135249} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 250, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 437846756} + - {fileID: 2099543392} + m_Father: {fileID: 1563905016} + m_RootOrder: 25 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &42135252 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 42135249} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &42135253 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 42135249} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 753155718} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &42378786 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 42378787} + - component: {fileID: 42378789} + - component: {fileID: 42378788} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &42378787 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 42378786} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 368348656} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &42378788 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 42378786} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &42378789 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 42378786} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &47460683 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 47460684} + - component: {fileID: 47460687} + - component: {fileID: 47460686} + - component: {fileID: 47460688} + m_Layer: 0 + m_Name: Colors + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &47460684 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 47460683} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 100, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1022452601} + - {fileID: 588736392} + m_Father: {fileID: 1563905016} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &47460686 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 47460683} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &47460687 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 47460683} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 473fd0e814452c4488d6794c3f24dff1, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &47460688 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 47460683} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 384dba07353e1f242b467b6857a1e3d4, type: 3} + m_Name: + m_EditorClassIdentifier: + numericPropertyName: _HsvShift + scrollSpeed: 500 + applyModulo: 1 + modulo: 360 + mat: {fileID: 0} +--- !u!1 &55667222 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4825911116503289154} + - component: {fileID: 55667224} + - component: {fileID: 55667225} + m_Layer: 0 + m_Name: Original + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &55667224 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 55667222} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1257475202} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &55667225 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 55667222} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &56751282 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 56751283} + - component: {fileID: 56751286} + - component: {fileID: 56751285} + m_Layer: 0 + m_Name: Original + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &56751283 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 124843813} + - {fileID: 646019452} + m_Father: {fileID: 1351315063} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &56751285 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &56751286 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1735095770} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &69675090 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 69675091} + - component: {fileID: 69675093} + - component: {fileID: 69675092} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &69675091 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 69675090} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 353408739} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &69675092 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 69675090} + m_Text: Hallucination + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &69675093 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 69675090} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &70619476 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - ALPHACUTOFF_ON + - OUTBASE8DIR_ON + - PIXELATE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.904 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0159 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 70 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &72928926 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - HOLOGRAM_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1.2 + - _HologramMinAlpha: 0.142 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 0.085 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 7 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 0.27421054, b: 0.38679248, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &73084414 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - HSV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1.5 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &85408337 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - BLUR_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &87388692 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - POLARUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 4, y: 4} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &98126757 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 98126758} + - component: {fileID: 98126760} + - component: {fileID: 98126759} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &98126758 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 98126757} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 407134450} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &98126759 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 98126757} + m_Text: Doodle + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &98126760 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 98126757} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &98690188 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 98690189} + - component: {fileID: 98690191} + - component: {fileID: 98690190} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &98690189 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 98690188} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1111461197} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &98690190 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 98690188} + m_Text: Pinch + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &98690191 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 98690188} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &102412576 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 102412577} + - component: {fileID: 102412578} + m_Layer: 0 + m_Name: Magic Tornado + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &102412577 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 102412576} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 210, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 582549648} + - {fileID: 799318216} + - {fileID: 1454273602} + - {fileID: 595980604} + - {fileID: 1586363708} + m_Father: {fileID: 1563905016} + m_RootOrder: 21 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &102412578 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 102412576} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &108846146 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORSWAP_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.09 + - _ColorSwapRedLuminosity: 0.604 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapRed: {r: 0, g: 0.5643088, b: 0.8396226, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &111852238 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GRADIENT_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0.858 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &114782626 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 114782627} + - component: {fileID: 114782629} + - component: {fileID: 114782628} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &114782627 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114782626} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 499272004} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &114782628 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114782626} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &114782629 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114782626} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &124794630 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 124794631} + - component: {fileID: 124794633} + - component: {fileID: 124794632} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &124794631 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124794630} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 950130248} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &124794632 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124794630} + m_Text: Grass + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &124794633 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124794630} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &124843812 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 124843813} + - component: {fileID: 124843815} + - component: {fileID: 124843814} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &124843813 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124843812} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 56751283} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &124843814 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124843812} + m_Text: Original Sprite + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &124843815 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124843812} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &133362205 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 133362206} + - component: {fileID: 133362208} + - component: {fileID: 133362207} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &133362206 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 133362205} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 746759203} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &133362207 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 133362205} + m_Text: Hit Effect + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &133362208 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 133362205} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &136921168 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 136921169} + - component: {fileID: 136921171} + - component: {fileID: 136921170} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &136921169 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 136921168} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1120052622} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &136921170 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 136921168} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &136921171 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 136921168} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &139334897 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CLIPPING_ON + - ROTATEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0.1 + - _ClipUvLeft: 0.1 + - _ClipUvRight: 0.1 + - _ClipUvUp: 0.1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 2.66 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &144455307 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 144455308} + - component: {fileID: 144455310} + - component: {fileID: 144455309} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &144455308 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 144455307} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 642204093} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &144455309 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 144455307} + m_Text: Screen Hit + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &144455310 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 144455307} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &150333392 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GHOST_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1.41 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &152938703 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 152938704} + - component: {fileID: 152938706} + - component: {fileID: 152938705} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &152938704 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 152938703} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1875180451} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &152938705 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 152938703} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &152938706 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 152938703} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &154474730 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 154474731} + - component: {fileID: 154474733} + - component: {fileID: 154474732} + m_Layer: 5 + m_Name: Controls + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &154474731 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 154474730} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 564363701} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1734.6, y: 127.8} + m_Pivot: {x: 0.5, y: 0} +--- !u!114 &154474732 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 154474730} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_FontSize: 56 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 79 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: 'Controls: Use WASD or Arrow Keys to move around' +--- !u!222 &154474733 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 154474730} + m_CullTransparentMesh: 0 +--- !u!1 &156196756 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 156196757} + - component: {fileID: 156196759} + - component: {fileID: 156196758} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &156196757 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 156196756} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 361311995} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &156196758 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 156196756} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &156196759 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 156196756} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &164406718 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 164406719} + - component: {fileID: 164406721} + - component: {fileID: 164406720} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &164406719 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 164406718} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1901854650} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &164406720 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 164406718} + m_Text: Offset + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &164406721 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 164406718} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &166039412 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 166039413} + - component: {fileID: 166039415} + m_Layer: 0 + m_Name: Round Wave + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &166039413 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 166039412} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 40, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1688633194} + - {fileID: 1100636068} + - {fileID: 924727831} + m_Father: {fileID: 1351315063} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &166039415 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 166039412} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &168046140 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 168046141} + - component: {fileID: 168046143} + - component: {fileID: 168046142} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &168046141 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168046140} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 420059981} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &168046142 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168046140} + m_Text: Shadow + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &168046143 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168046140} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &183278329 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - WIND_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.437 + - _FadeBurnGlow: 6.6 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 6.9 + - _GrassWind: 14.7 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &195375977 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - FADE_ON + - OUTBASE8DIR_ON + - PINCH_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: dbaa905cec0d2b944b5d1ebdbc3ceb1e, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.391 + - _FadeBurnGlow: 1.9 + - _FadeBurnTransition: 0.274 + - _FadeBurnWidth: 0.07 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0141 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 0, g: 0.9400835, b: 1, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.94117653, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &208665463 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - WAVEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 11.71 + - _WaveStrength: 11.52 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &212554433 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CLIPPING_ON + - WAVEUV_ON + - WIND_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0.1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 1.5 + - _GrassWind: 1.9 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 1.5 + - _WaveSpeed: 6.7 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &217718272 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CHANGECOLOR2_ON + - CHANGECOLOR3_ON + - COLORSWAP_ON + - GLOWTEX_ON + - GRADIENT2COL_ON + - GRADIENT_ON + - OUTBASE8DIR_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 4abae6e7a5c534a4c8e95edf12a7d0c9, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.28 + - _ColorSwapRedLuminosity: 0.481 + - _Contrast: 3.29 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 0 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.4 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 6 + - _InnerOutlineThickness: 1.31 + - _MaxXUV: 0.97509766 + - _MaxYUV: 0.9902344 + - _MinXUV: 0.68408203 + - _MinYUV: 0.6455078 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 5.1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0321 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.059 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 0.1 + - _RoundWaveStrength: 0.014 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7.4 + - _WaveSpeed: 11.1 + - _WaveStrength: 16.4 + - _WaveX: 0.496 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.9716981, g: 0.1283375, b: 0.46596614, a: 1} + - _ColorSwapGreen: {r: 3.0196679, g: 1.6945816, b: 0, a: 1} + - _ColorSwapRed: {r: 0.24279101, g: 0.56585985, b: 0.8301887, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.98823535, g: 0.6392157, b: 0.6117647, a: 1} + - _GradBotLeftCol: {r: 0.16037738, g: 0.16037738, b: 0.16037738, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 0.103773594, g: 0.103773594, b: 0.103773594, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 0.9811321, g: 0.29619083, b: 0.7939467, a: 1} + - _OutlineColor: {r: 0.5896226, g: 0.1792453, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &242385328 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 242385329} + - component: {fileID: 242385332} + m_Layer: 0 + m_Name: Water + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &242385329 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 242385328} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 160, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 928177173} + - {fileID: 942262413} + - {fileID: 1673476643} + - {fileID: 1949787730} + m_Father: {fileID: 1563905016} + m_RootOrder: 16 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &242385332 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 242385328} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &242658909 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 242658910} + - component: {fileID: 242658912} + - component: {fileID: 242658911} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &242658910 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 242658909} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2096881075} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &242658911 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 242658909} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &242658912 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 242658909} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &245082890 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 245082891} + - component: {fileID: 245082893} + - component: {fileID: 245082892} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &245082891 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245082890} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 642204093} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &245082892 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245082890} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &245082893 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245082890} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &252177635 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 252177636} + - component: {fileID: 252177639} + - component: {fileID: 252177638} + m_Layer: 0 + m_Name: Gameboy + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &252177636 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 20, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 605528100} + - {fileID: 2004669564} + m_Father: {fileID: 1563905016} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &252177638 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &252177639 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 288262069} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &266318147 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 266318148} + - component: {fileID: 266318150} + - component: {fileID: 266318149} + m_Layer: 0 + m_Name: HitSprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &266318148 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 266318147} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 227.2355, y: 122.83, z: 122.83} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 642204093} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &266318149 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 266318147} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &266318150 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 266318147} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1956560312} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 839adabbc5de26041bac66450214a831, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.04, y: 0.04} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &269805653 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 269805654} + - component: {fileID: 269805656} + - component: {fileID: 269805655} + m_Layer: 0 + m_Name: Back + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &269805654 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 269805653} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0.01} + m_LocalScale: {x: 0.9196, y: 0.65, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 540070583} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &269805655 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 269805653} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &269805656 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 269805653} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1024727761} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: fab06e0be9375cc4d823efa71629885c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &275948669 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 275948670} + - component: {fileID: 275948672} + - component: {fileID: 275948671} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &275948670 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 275948669} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 485976056} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &275948671 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 275948669} + m_Text: Glitch + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &275948672 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 275948669} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &288262069 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORRAMP_ON + - GLOWTEX_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - PIXELATE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 285a35f6ccf7b1a44b6c198e96105173, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.531 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.75 + - _ColorSwapGreenLuminosity: 0.264 + - _ColorSwapRedLuminosity: 0.75 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.437 + - _FadeBurnGlow: 6.6 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 2.5 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 6.9 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0539 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 40 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 1.61 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.41037738, g: 0.5180799, b: 1, a: 1} + - _ColorSwapGreen: {r: 0, g: 1, b: 0.96124196, a: 1} + - _ColorSwapRed: {r: 0.9528302, g: 0.783215, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!4 &290590332 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 30, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 14374125} + - {fileID: 1511231070} + m_Father: {fileID: 2036092933} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &290590333 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 290590332} + - component: {fileID: 290590335} + - component: {fileID: 290590336} + m_Layer: 0 + m_Name: Outline1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &290590335 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 7746739} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &290590336 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &294421775 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 294421776} + - component: {fileID: 294421778} + - component: {fileID: 294421777} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &294421776 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 294421775} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1229041066} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &294421777 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 294421775} + m_Text: HueShift + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &294421778 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 294421775} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &297942434 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 297942435} + - component: {fileID: 297942437} + - component: {fileID: 297942436} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &297942435 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297942434} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1123731223} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &297942436 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297942434} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &297942437 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297942434} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &298142066 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 298142067} + - component: {fileID: 298142069} + - component: {fileID: 298142068} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &298142067 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298142066} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 939106332} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &298142068 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298142066} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &298142069 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298142066} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &298228098 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 298228099} + - component: {fileID: 298228101} + - component: {fileID: 298228100} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &298228099 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298228098} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1374997139} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &298228100 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298228098} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &298228101 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298228098} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &302907434 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - POSTERIZE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &305999440 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 305999441} + - component: {fileID: 305999443} + - component: {fileID: 305999442} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &305999441 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 305999440} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 972134371} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &305999442 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 305999440} + m_Text: Distortion + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &305999443 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 305999440} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &312669277 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 312669278} + - component: {fileID: 312669281} + - component: {fileID: 312669280} + m_Layer: 0 + m_Name: AlphaOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &312669278 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312669277} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 60, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1438024880} + - {fileID: 706131457} + m_Father: {fileID: 2036092933} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &312669280 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312669277} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &312669281 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 312669277} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2076240280} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &313393139 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - OUTBASE8DIR_ON + - OUTBASE_ON + - OUTTEX_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + - _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.011 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &316406007 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 316406008} + - component: {fileID: 316406010} + - component: {fileID: 316406009} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &316406008 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316406007} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 597182738} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &316406009 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316406007} + m_Text: Color Ramp + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &316406010 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316406007} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &316897174 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 316897175} + - component: {fileID: 316897177} + - component: {fileID: 316897176} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &316897175 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316897174} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1286689243} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &316897176 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316897174} + m_Text: Hologram + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &316897177 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 316897174} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &317082044 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 317082045} + - component: {fileID: 317082047} + - component: {fileID: 317082046} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &317082045 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 317082044} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 586081879} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &317082046 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 317082044} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &317082047 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 317082044} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &322195377 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 322195378} + - component: {fileID: 322195380} + - component: {fileID: 322195379} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &322195378 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322195377} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1028271463} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &322195379 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322195377} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &322195380 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322195377} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &323921624 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CLIPPING_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0.394 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &326244154 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 326244155} + - component: {fileID: 326244157} + - component: {fileID: 326244156} + m_Layer: 0 + m_Name: Obstacle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &326244155 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 326244154} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -0.74, z: -0.025} + m_LocalScale: {x: 0.14763856, y: 0.40729, z: 0.40729} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1478122371} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &326244156 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 326244154} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 0 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &326244157 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 326244154} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 212554433} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: cf7e1f6ebb800154db2b215cba9330ee, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &327735240 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - BLUR_ON + - CLIPPING_ON + - DISTORT_ON + - GLOW_ON + - WAVEUV_ON + - WIND_ON + m_InvalidKeywords: + - CUSTOMBLENDING_ON + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 100 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0.03 + - _ClipUvRight: 0 + - _ClipUvUp: 0.042 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.81 + - _DistortTexXSpeed: -1 + - _DistortTexYSpeed: -5.9 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 7.7 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 5.7 + - _GrassWind: 5.2 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 0.6775423, b: 0, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.047169805, b: 0.07456907, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &337231024 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 337231025} + - component: {fileID: 337231027} + - component: {fileID: 337231026} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &337231025 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 337231024} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2082220742} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &337231026 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 337231024} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &337231027 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 337231024} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &352221783 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 352221784} + - component: {fileID: 352221786} + - component: {fileID: 352221785} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &352221784 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 352221783} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1434614528} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &352221785 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 352221783} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &352221786 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 352221783} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &353408738 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 353408739} + - component: {fileID: 353408742} + - component: {fileID: 353408741} + - component: {fileID: 353408743} + m_Layer: 0 + m_Name: Hallucination + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &353408739 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 110, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 69675091} + - {fileID: 684127073} + m_Father: {fileID: 1563905016} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &353408741 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &353408742 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2054684528} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &353408743 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 009a1cbada3894e4387ecb3a8a39e335, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!1 &355247222 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 355247223} + - component: {fileID: 355247225} + - component: {fileID: 355247224} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &355247223 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 355247222} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1123731223} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &355247224 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 355247222} + m_Text: Overlay Texture + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &355247225 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 355247222} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &356332865 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 356332866} + - component: {fileID: 356332869} + - component: {fileID: 356332868} + - component: {fileID: 356332867} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &356332866 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 564363701} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &356332867 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &356332868 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 1774554235} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &356332869 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_CullTransparentMesh: 0 +--- !u!1 &357954208 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 357954209} + - component: {fileID: 357954212} + - component: {fileID: 357954211} + m_Layer: 0 + m_Name: TwistedFace + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &357954209 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 357954208} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 260, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2008035789} + - {fileID: 1869989730} + m_Father: {fileID: 1563905016} + m_RootOrder: 26 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &357954211 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 357954208} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &357954212 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 357954208} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1349909629} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &361311994 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 361311995} + - component: {fileID: 361311998} + - component: {fileID: 361311997} + m_Layer: 0 + m_Name: Wind + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &361311995 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 361311994} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 20, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2076635524} + - {fileID: 156196757} + m_Father: {fileID: 1351315063} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &361311997 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 361311994} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &361311998 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 361311994} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 183278329} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &367923810 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 367923811} + - component: {fileID: 367923813} + - component: {fileID: 367923812} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &367923811 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 367923810} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1050471976} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &367923812 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 367923810} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &367923813 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 367923810} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &368348655 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 368348656} + - component: {fileID: 368348658} + - component: {fileID: 368348659} + m_Layer: 0 + m_Name: Ghost + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &368348656 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 220, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1471800765} + - {fileID: 42378787} + m_Father: {fileID: 2036092933} + m_RootOrder: 22 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &368348658 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 150333392} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &368348659 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &376742881 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 376742882} + - component: {fileID: 376742884} + - component: {fileID: 376742883} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &376742882 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 376742881} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1813870144} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &376742883 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 376742881} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &376742884 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 376742881} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &396641005 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 396641006} + - component: {fileID: 396641008} + - component: {fileID: 396641007} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &396641006 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 396641005} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1934762264} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &396641007 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 396641005} + m_Text: Burn + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &396641008 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 396641005} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &401883083 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 401883084} + - component: {fileID: 401883086} + - component: {fileID: 401883085} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &401883084 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 401883083} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 471382084} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &401883085 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 401883083} + m_Text: Inner Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &401883086 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 401883083} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &407134449 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 407134450} + - component: {fileID: 407134453} + - component: {fileID: 407134452} + - component: {fileID: 407134451} + m_Layer: 0 + m_Name: Doodle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &407134450 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 407134449} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 230, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 98126758} + - {fileID: 415056644} + m_Father: {fileID: 1563905016} + m_RootOrder: 23 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &407134451 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 407134449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &407134452 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 407134449} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1459191230} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 73d3cc63327012249b4f98eb9289311d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &407134453 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 407134449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &409423830 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 409423831} + - component: {fileID: 409423832} + m_Layer: 0 + m_Name: Mask + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &409423831 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409423830} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 3.2125397, y: 4.672785, z: 4.672785} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1756331349} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!331 &409423832 +SpriteMask: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409423830} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10758, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 4b40fc0f65c85f14fbc9c7c5f40ca686, type: 3} + m_MaskAlphaCutoff: 0.2 + m_FrontSortingLayerID: 0 + m_BackSortingLayerID: 0 + m_FrontSortingLayer: 0 + m_BackSortingLayer: 0 + m_FrontSortingOrder: 0 + m_BackSortingOrder: 0 + m_IsCustomRangeActive: 0 + m_SpriteSortPoint: 0 +--- !u!1 &415056643 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 415056644} + - component: {fileID: 415056646} + - component: {fileID: 415056645} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &415056644 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415056643} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 407134450} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &415056645 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415056643} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &415056646 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415056643} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!4 &419407226 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 419407227} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 40, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 849687025} + - {fileID: 846281939} + m_Father: {fileID: 2036092933} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &419407227 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 419407226} + - component: {fileID: 419407229} + - component: {fileID: 419407230} + m_Layer: 0 + m_Name: Outline2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &419407229 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 419407227} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 313393139} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &419407230 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 419407227} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &419511669 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 419511670} + - component: {fileID: 419511672} + - component: {fileID: 419511671} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &419511670 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 419511669} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 584220654} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &419511671 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 419511669} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &419511672 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 419511669} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &420059980 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 420059981} + - component: {fileID: 420059983} + - component: {fileID: 420059984} + m_Layer: 0 + m_Name: Shadow + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &420059981 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420059980} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 270, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 168046141} + - {fileID: 820886078} + m_Father: {fileID: 2036092933} + m_RootOrder: 27 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &420059983 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420059980} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1105303541} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &420059984 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420059980} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &427761888 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 427761889} + - component: {fileID: 427761891} + - component: {fileID: 427761890} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &427761889 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 427761888} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1931308735} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &427761890 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 427761888} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &427761891 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 427761888} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &430987701 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - BLUR_ON + - HITEFFECT_ON + - OUTBASE8DIR_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 6.8 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 193 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.091 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 0.46328974, g: 0, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &435111025 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 435111026} + - component: {fileID: 435111028} + - component: {fileID: 435111027} + m_Layer: 0 + m_Name: Outline3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &435111026 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 435111025} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.11, y: -0.66, z: 0.05} + m_LocalScale: {x: 1.0657709, y: 1.0657709, z: 1.0657709} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &435111027 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 435111025} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 0 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &435111028 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 435111025} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 2fff2435ee99439438c463e2ce768283, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &437846755 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 437846756} + - component: {fileID: 437846758} + - component: {fileID: 437846757} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &437846756 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 437846755} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 42135250} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &437846757 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 437846755} + m_Text: Spooky Soldier + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &437846758 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 437846755} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &443722313 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 443722314} + - component: {fileID: 443722316} + - component: {fileID: 443722315} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &443722314 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 443722313} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1931308735} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &443722315 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 443722313} + m_Text: Color Swap + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &443722316 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 443722313} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &443772010 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 443772011} + - component: {fileID: 443772014} + - component: {fileID: 443772013} + m_Layer: 0 + m_Name: Texture Scroll + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &443772011 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 443772010} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 80, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1618143722} + - {fileID: 1939042051} + m_Father: {fileID: 1351315063} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &443772013 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 443772010} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &443772014 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 443772010} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1230234141} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &450696183 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 450696184} + - component: {fileID: 450696188} + - component: {fileID: 450696185} + - component: {fileID: 450696187} + m_Layer: 0 + m_Name: Procedural Soldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &450696184 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 450696183} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 290, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1727216260} + - {fileID: 746778958} + m_Father: {fileID: 1563905016} + m_RootOrder: 29 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &450696185 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 450696183} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4ef3964599ee48c4ea5a4ecf012ed949, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &450696187 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 450696183} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &450696188 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 450696183} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2066467196} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &453643567 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - ONLYOUTLINE_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _ONLYOUTLINE_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 1 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.012 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &453652827 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 453652828} + - component: {fileID: 453652830} + - component: {fileID: 453652829} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &453652828 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 453652827} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1613686741} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &453652829 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 453652827} + m_Text: Fade + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &453652830 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 453652827} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &465147594 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GRADIENT_ON + - RADIALGRADIENT_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GRADISRADIAL_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0.876 + - _GradBoostX: 0.98 + - _GradBoostY: 1.2 + - _GradIsRadial: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0.28235295, b: 0.05495002, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 0.9940848, g: 1, b: 0.3679245, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &469847421 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - DOODLE_ON + - GLOWTEX_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 3.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 12.82 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.7193959, b: 0.1273585, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &471382083 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 471382084} + - component: {fileID: 471382086} + - component: {fileID: 471382087} + m_Layer: 0 + m_Name: Inner Outline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &471382084 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 70, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 401883084} + - {fileID: 720867420} + m_Father: {fileID: 2036092933} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &471382086 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 537809413} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &471382087 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &482750998 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 482750999} + - component: {fileID: 482751001} + - component: {fileID: 482751000} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &482750999 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 482750998} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1478122371} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &482751000 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 482750998} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &482751001 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 482750998} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &485976055 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 485976056} + - component: {fileID: 485976058} + - component: {fileID: 485976059} + m_Layer: 0 + m_Name: Glitch + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &485976056 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 485976055} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 250, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 275948670} + - {fileID: 566664014} + m_Father: {fileID: 2036092933} + m_RootOrder: 25 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &485976058 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 485976055} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1181865632} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &485976059 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 485976055} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &487308174 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 487308175} + - component: {fileID: 487308177} + - component: {fileID: 487308176} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &487308175 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 487308174} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1329663900} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &487308176 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 487308174} + m_Text: Poolar Coords + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &487308177 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 487308174} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &489557968 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 489557969} + - component: {fileID: 489557971} + - component: {fileID: 489557970} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &489557969 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 489557968} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1675838108} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &489557970 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 489557968} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &489557971 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 489557968} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &499272003 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 499272004} + - component: {fileID: 499272007} + - component: {fileID: 499272006} + m_Layer: 0 + m_Name: BlurredOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &499272004 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 499272003} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 270, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1916465496} + - {fileID: 2064997618} + - {fileID: 114782627} + m_Father: {fileID: 1563905016} + m_RootOrder: 27 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &499272006 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 499272003} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &499272007 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 499272003} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1439702669} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &499438416 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 499438417} + - component: {fileID: 499438419} + - component: {fileID: 499438418} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &499438417 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 499438416} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1986728942} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &499438418 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 499438416} + m_Text: Zoom + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &499438419 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 499438416} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &510732447 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 510732448} + - component: {fileID: 510732450} + - component: {fileID: 510732449} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &510732448 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 510732447} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1073973762} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &510732449 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 510732447} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &510732450 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 510732447} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &511167260 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 511167261} + - component: {fileID: 511167265} + - component: {fileID: 511167264} + - component: {fileID: 511167262} + - component: {fileID: 511167266} + m_Layer: 0 + m_Name: IceSoldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &511167261 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511167260} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 350, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 711155183} + - {fileID: 1078196207} + - {fileID: 1527473307} + - {fileID: 1884970177} + m_Father: {fileID: 1563905016} + m_RootOrder: 35 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!331 &511167262 +SpriteMask: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511167260} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10758, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_MaskAlphaCutoff: 0.2 + m_FrontSortingLayerID: 0 + m_BackSortingLayerID: 0 + m_FrontSortingLayer: 0 + m_BackSortingLayer: 0 + m_FrontSortingOrder: 0 + m_BackSortingOrder: 0 + m_IsCustomRangeActive: 0 + m_SpriteSortPoint: 0 +--- !u!114 &511167264 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511167260} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &511167265 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511167260} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: d27799974f79b894196aeeef8bac53af, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &511167266 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511167260} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: c2df20f2d12e21b46bacd5dfa839b92e, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!1 &520963777 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 520963778} + - component: {fileID: 520963780} + - component: {fileID: 520963779} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &520963778 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520963777} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1875180451} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &520963779 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520963777} + m_Text: Teleport + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &520963780 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520963777} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &535274221 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 535274222} + - component: {fileID: 535274224} + - component: {fileID: 535274223} + m_Layer: 5 + m_Name: ExpositorTitleOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &535274222 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 535274221} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1005972827} + m_Father: {fileID: 564363701} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: -87} + m_SizeDelta: {x: 160, y: 121.23} + m_Pivot: {x: 0.5, y: 1} +--- !u!114 &535274223 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 535274221} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_FontSize: 123 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 123 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: Color Effects +--- !u!222 &535274224 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 535274221} + m_CullTransparentMesh: 0 +--- !u!21 &537809413 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - INNEROUTLINE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 10 + - _InnerOutlineThickness: 2.01 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0.2028302, b: 0.9452239, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &540070582 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 540070583} + - component: {fileID: 540070586} + - component: {fileID: 540070585} + - component: {fileID: 540070584} + m_Layer: 0 + m_Name: Frame + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &540070583 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540070582} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 6.839, y: 1.962, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 269805654} + - {fileID: 1120672005} + m_Father: {fileID: 1211354477} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &540070584 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540070582} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: f36bce3b3e7e3c5488117e16e426deb5, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &540070585 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540070582} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &540070586 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540070582} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1537019967} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: fab06e0be9375cc4d823efa71629885c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &540543599 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - DISTORT_ON + - GLOW_ON + - WAVEUV_ON + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 7f33f36658f399a44be84455bcd911b1, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 2 + - _DistortTexYSpeed: 2 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 4.4 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0.5 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &540549268 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 540549269} + - component: {fileID: 540549273} + - component: {fileID: 540549272} + - component: {fileID: 540549270} + m_Layer: 0 + m_Name: RadialFillAmount + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &540549269 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540549268} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 70, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 718105016} + - {fileID: 1843941480} + m_Father: {fileID: 1351315063} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &540549270 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540549268} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: f325edee1e9fb044eb0d87aad6d3ece0, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &540549272 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540549268} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &540549273 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 540549268} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1118634257} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &545525088 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 545525089} + - component: {fileID: 545525091} + - component: {fileID: 545525090} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &545525089 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 545525088} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 597182738} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &545525090 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 545525088} + m_Text: (Gradient Property) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &545525091 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 545525088} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &548255499 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 548255500} + - component: {fileID: 548255504} + - component: {fileID: 548255503} + - component: {fileID: 548255501} + m_Layer: 0 + m_Name: Shine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &548255500 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 548255499} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 280, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 668913776} + - {fileID: 582865293} + m_Father: {fileID: 2036092933} + m_RootOrder: 28 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &548255501 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 548255499} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 1b6613bf9b3fea94380070ae23178552, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &548255503 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 548255499} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &548255504 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 548255499} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2136425119} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &550220620 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 550220621} + - component: {fileID: 550220623} + - component: {fileID: 550220622} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &550220621 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 550220620} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.5699997, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1756331349} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &550220622 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 550220620} + m_Text: (Has Sprite Mask) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &550220623 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 550220620} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &556503703 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 556503704} + - component: {fileID: 556503706} + - component: {fileID: 556503705} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &556503704 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 556503703} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1923390774} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &556503705 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 556503703} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &556503706 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 556503703} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &564363697 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 564363701} + - component: {fileID: 564363700} + - component: {fileID: 564363699} + - component: {fileID: 564363698} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &564363698 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &564363699 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1920, y: 1080} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &564363700 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 1 + m_Camera: {fileID: 999529079} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: -1 + m_TargetDisplay: 0 +--- !u!224 &564363701 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 356332866} + - {fileID: 1302433542} + - {fileID: 535274222} + - {fileID: 154474731} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &566664013 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 566664014} + - component: {fileID: 566664016} + - component: {fileID: 566664015} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &566664014 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 566664013} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 485976056} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &566664015 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 566664013} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &566664016 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 566664013} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &581202604 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORRAMP_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &582549647 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 582549648} + - component: {fileID: 582549650} + - component: {fileID: 582549649} + - component: {fileID: 582549651} + m_Layer: 0 + m_Name: FireBack + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &582549648 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582549647} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.5838726, y: 1.5838726, z: 1.5838726} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 102412577} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &582549649 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582549647} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &582549650 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582549647} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 1c2c3a51f881cb443906a57116cf56fe, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 2ea3ea54c499d314f957e0a47dc11c9c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &582549651 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582549647} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 384dba07353e1f242b467b6857a1e3d4, type: 3} + m_Name: + m_EditorClassIdentifier: + numericPropertyName: _RotateUvAmount + scrollSpeed: 5 + applyModulo: 1 + modulo: 6.28 + mat: {fileID: 0} +--- !u!1 &582865292 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 582865293} + - component: {fileID: 582865295} + - component: {fileID: 582865294} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &582865293 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582865292} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 548255500} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &582865294 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582865292} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &582865295 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 582865292} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &584220653 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 584220654} + - component: {fileID: 584220657} + - component: {fileID: 584220656} + m_Layer: 0 + m_Name: Thermal Vision + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &584220654 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 584220653} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 320, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1464450239} + - {fileID: 419511670} + m_Father: {fileID: 1563905016} + m_RootOrder: 32 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &584220656 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 584220653} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &584220657 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 584220653} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1065071623} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &586081878 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 586081879} + - component: {fileID: 586081881} + - component: {fileID: 586081882} + m_Layer: 0 + m_Name: Greyscale + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &586081879 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 586081878} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 180, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1880243540} + - {fileID: 317082045} + m_Father: {fileID: 2036092933} + m_RootOrder: 18 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &586081881 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 586081878} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 665239746} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &586081882 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 586081878} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &588736391 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 588736392} + - component: {fileID: 588736394} + - component: {fileID: 588736393} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &588736392 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 588736391} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 47460684} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &588736393 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 588736391} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &588736394 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 588736391} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &595151376 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 595151377} + - component: {fileID: 595151378} + m_Layer: 0 + m_Name: Pattern + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &595151377 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 595151376} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 120, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 5952972451371321220} + - {fileID: 834551331} + - {fileID: 2117073028} + m_Father: {fileID: 1563905016} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &595151378 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 595151376} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &595980603 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 595980604} + - component: {fileID: 595980606} + - component: {fileID: 595980605} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &595980604 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 595980603} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 102412577} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &595980605 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 595980603} + m_Text: Magic Tornado + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &595980606 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 595980603} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &597182737 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 597182738} + - component: {fileID: 597182741} + - component: {fileID: 597182740} + m_Layer: 0 + m_Name: Color Ramp Gradient + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &597182738 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 597182737} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 140, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 316406008} + - {fileID: 545525089} + m_Father: {fileID: 2036092933} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &597182740 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 597182737} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &597182741 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 597182737} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 1c07bf10ccbd5c643b7a3d99b400a745, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &601434482 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 601434483} + - component: {fileID: 601434485} + - component: {fileID: 601434484} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &601434483 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 601434482} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1350115731} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &601434484 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 601434482} + m_Text: Evil Marine + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &601434485 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 601434482} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &605528099 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 605528100} + - component: {fileID: 605528102} + - component: {fileID: 605528101} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &605528100 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 605528099} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 252177636} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &605528101 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 605528099} + m_Text: Gameboy + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &605528102 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 605528099} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &608638372 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 608638373} + - component: {fileID: 608638375} + - component: {fileID: 608638374} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &608638373 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 608638372} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1675838108} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &608638374 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 608638372} + m_Text: Army + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &608638375 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 608638372} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &611714447 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CLIPPING_ON + - COLORRAMP_ON + - OFFSETUV_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 359431ef2af87794198688f7c632c1e3, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0.04 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0156 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &624559470 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 624559471} + - component: {fileID: 624559473} + - component: {fileID: 624559472} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &624559471 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 624559470} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 984096428} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &624559472 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 624559470} + m_Text: 'Gradient + +' + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &624559473 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 624559470} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &639189023 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - FADE_ON + - GLOWTEX_ON + - HITEFFECT_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.415 + - _FadeBurnGlow: 15 + - _FadeBurnTransition: 0.105 + - _FadeBurnWidth: 0.026 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 3.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 12.82 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 0 + - _HitEffectGlow: 10.6 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 9.8 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.011 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: 0 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 0.6053487, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.7193959, b: 0.1273585, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 0.9622642, g: 0.10987086, b: 0, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.10969916, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &642204092 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 642204093} + - component: {fileID: 642204094} + - component: {fileID: 642204095} + m_Layer: 0 + m_Name: ScreenHit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &642204093 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 642204092} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 200, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 266318148} + - {fileID: 144455308} + - {fileID: 245082891} + m_Father: {fileID: 1563905016} + m_RootOrder: 20 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &642204094 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 642204092} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!95 &642204095 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 642204092} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 1220612ba20667d46a6e8356073b69b0, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!1 &644371591 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 644371592} + - component: {fileID: 644371594} + - component: {fileID: 644371593} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &644371592 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 644371591} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1778749804} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &644371593 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 644371591} + m_Text: Hand Drawn + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &644371594 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 644371591} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &646019451 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 646019452} + - component: {fileID: 646019454} + - component: {fileID: 646019453} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &646019452 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 646019451} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 56751283} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &646019453 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 646019451} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &646019454 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 646019451} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &653496752 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - MOTIONBLUR_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.345 + - _MotionBlurDist: -1.44 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &665239746 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GREYSCALE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0.097 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &668913775 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 668913776} + - component: {fileID: 668913778} + - component: {fileID: 668913777} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &668913776 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668913775} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 548255500} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &668913777 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668913775} + m_Text: Shine + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &668913778 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668913775} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &671117225 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 671117226} + - component: {fileID: 671117230} + - component: {fileID: 671117229} + - component: {fileID: 671117228} + - component: {fileID: 671117227} + m_Layer: 0 + m_Name: Sprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &671117226 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671117225} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 939106332} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &671117227 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671117225} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 33212171a9274b947914d32a914af1a3, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &671117228 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671117225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &671117229 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671117225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &671117230 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671117225} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 653496752} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &682244416 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 682244417} + - component: {fileID: 682244419} + - component: {fileID: 682244418} + m_Layer: 0 + m_Name: FireFront + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &682244417 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 682244416} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.56, z: -0.05} + m_LocalScale: {x: 0.4067901, y: 0.4067901, z: 0.4067901} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1953432852} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &682244418 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 682244416} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &682244419 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 682244416} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 327735240} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: bd6f48b4407043345b1a3a07df8c4d61, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.04, y: 0.04} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &684127072 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 684127073} + - component: {fileID: 684127075} + - component: {fileID: 684127074} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &684127073 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684127072} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 353408739} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &684127074 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684127072} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &684127075 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684127072} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &684661038 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 684661039} + - component: {fileID: 684661041} + - component: {fileID: 684661040} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &684661039 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684661038} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 766050008} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &684661040 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684661038} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &684661041 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 684661038} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &694591669 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 694591670} + - component: {fileID: 694591673} + - component: {fileID: 694591671} + m_Layer: 0 + m_Name: Minimalist Soldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &694591670 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 694591669} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 300, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1308471598} + - {fileID: 1466512396} + m_Father: {fileID: 1563905016} + m_RootOrder: 30 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &694591671 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 694591669} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &694591673 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 694591669} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 217718272} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &706131456 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 706131457} + - component: {fileID: 706131459} + - component: {fileID: 706131458} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &706131457 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 706131456} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 312669278} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &706131458 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 706131456} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &706131459 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 706131456} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &711155182 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 711155183} + - component: {fileID: 711155184} + m_Layer: 0 + m_Name: Ice + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &711155183 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 711155182} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.0582, y: 0.0425, z: -0.1} + m_LocalScale: {x: 0.67673415, y: 0.7130322, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 511167261} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &711155184 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 711155182} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: e4599046180b0ac49b3df99ab01b3e27, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 49cc75da86b2bb949b1235ad2a384f9b, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 1 + m_SpriteSortPoint: 0 +--- !u!1 &712974875 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 712974876} + - component: {fileID: 712974878} + - component: {fileID: 712974877} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &712974876 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 712974875} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1329663900} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &712974877 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 712974875} + m_Text: (Texture is Tiled) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &712974878 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 712974875} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &718105015 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 718105016} + - component: {fileID: 718105018} + - component: {fileID: 718105017} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &718105016 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 718105015} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 540549269} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &718105017 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 718105015} + m_Text: Radial Fill Amount + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &718105018 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 718105015} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &720867419 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 720867420} + - component: {fileID: 720867422} + - component: {fileID: 720867421} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &720867420 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 720867419} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 471382084} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &720867421 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 720867419} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &720867422 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 720867419} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &727703726 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - BLUR_ON + - TEXTURESCROLL_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 11.1 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 0.5 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &732186308 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 732186310} + - component: {fileID: 732186309} + m_Layer: 0 + m_Name: Expositors + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &732186309 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 732186308} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b549ed925b49d274c876184f60faabdf, type: 3} + m_Name: + m_EditorClassIdentifier: + expositors: + - {fileID: 2036092934} + - {fileID: 1351315062} + - {fileID: 1563905015} + expositorsTitle: {fileID: 1005972828} + expositorsTitleOutline: {fileID: 535274223} + expositorDistance: -75 + background: {fileID: 356332865} + colorLerpSpeed: 2.5 +--- !u!4 &732186310 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 732186308} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2036092933} + - {fileID: 1351315063} + - {fileID: 1563905016} + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &746759202 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 746759203} + - component: {fileID: 746759205} + - component: {fileID: 746759206} + - component: {fileID: 746759207} + m_Layer: 0 + m_Name: Hit Effect + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &746759203 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 150, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 133362206} + - {fileID: 1522371944} + m_Father: {fileID: 2036092933} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &746759205 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 950928387} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &746759206 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!95 &746759207 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: c6e411a605ec50345a36bbab9d3cc722, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!1 &746778957 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 746778958} + - component: {fileID: 746778960} + - component: {fileID: 746778959} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &746778958 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746778957} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 450696184} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &746778959 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746778957} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &746778960 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746778957} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &753155718 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CLIPPING_ON + - COLORSWAP_ON + - DISTORT_ON + - GLOWTEX_ON + - GLOW_ON + - GREYSCALEOUTLINE_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - OUTDIST_ON + - OUTTEX_ON + - PINCH_ON + - ROUNDWAVEUV_ON + - ZOOMUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - OUTGREYTEXTURE_ON + - _GLOWTEXUSED_ON + - _GREYSCALEOUTLINE_ON + - _OUTLINE8DIRECTIONS_ON + - _OUTLINEDISTORTTOGGLE_ON + - _OUTLINETEXGREY_ON + - _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.1, y: 0.1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 0.65 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0.179 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0.086 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0.26 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.28 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.2 + - _DistortTexXSpeed: 1 + - _DistortTexYSpeed: 1 + - _EditorDrawers: 6 + - _FadeAmount: 0.461 + - _FadeBurnGlow: 1 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1.8 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 14.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0.27 + - _GreyscaleOutline: 1 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 2 + - _HsvSaturation: 0.92 + - _HsvShift: 151 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 6 + - _InnerOutlineThickness: 1.31 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.67 + - _OutlineDistortTexXSpeed: 0.2 + - _OutlineDistortTexYSpeed: -1 + - _OutlineDistortToggle: 1 + - _OutlineGlow: 15.7 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 1 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 0.5 + - _OutlineTexYSpeed: -3.3 + - _OutlineWidth: 0 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.118 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 0.38 + - _RoundWaveStrength: 0.063 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7.5 + - _WaveSpeed: 9.4 + - _WaveStrength: 22.4 + - _WaveX: 0.106 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.92 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.6687399, g: 1, b: 0.2924528, a: 1} + - _ColorSwapGreen: {r: 1, g: 0.020314153, b: 0, a: 1} + - _ColorSwapRed: {r: 0, g: 0.46226418, b: 0.023657747, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.49019608, g: 0.41710952, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0.45882368, g: 1, b: 0, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 0.9811321, g: 0.29619083, b: 0.7939467, a: 1} + - _OutlineColor: {r: 0.3073311, g: 1, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &766050007 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 766050008} + - component: {fileID: 766050012} + - component: {fileID: 766050011} + - component: {fileID: 766050009} + m_Layer: 0 + m_Name: Gradient Scroll + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &766050008 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 766050007} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 90, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1675907431} + - {fileID: 684661039} + m_Father: {fileID: 1563905016} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &766050009 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 766050007} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: edeeb31731bec5f4092bbc3bbff03e91, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &766050011 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 766050007} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &766050012 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 766050007} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 946451345} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &772177650 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - FADE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.437 + - _FadeBurnGlow: 13.5 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &778370415 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 778370416} + - component: {fileID: 778370418} + - component: {fileID: 778370417} + m_Layer: 0 + m_Name: Sprite2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &778370416 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778370415} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.22, y: 0.82, z: -0.05} + m_LocalScale: {x: 1.0080961, y: 1.0080961, z: 1.0080961} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &778370417 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778370415} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 0 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &778370418 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778370415} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2128149943} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &786925990 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 786925991} + - component: {fileID: 786925994} + - component: {fileID: 786925993} + m_Layer: 0 + m_Name: Fish Eye + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &786925991 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 150, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1302959054} + - {fileID: 1039947233} + m_Father: {fileID: 1351315063} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &786925993 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &786925994 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1150284212} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &789390131 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 789390132} + - component: {fileID: 789390134} + - component: {fileID: 789390133} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &789390132 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 789390131} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1350115731} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &789390133 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 789390131} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &789390134 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 789390131} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &793013507 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 793013508} + - component: {fileID: 793013510} + - component: {fileID: 793013509} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &793013508 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793013507} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1119325822} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &793013509 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793013507} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &793013510 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793013507} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &797006599 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 797006600} + - component: {fileID: 797006602} + - component: {fileID: 797006601} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &797006600 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 797006599} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1028271463} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &797006601 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 797006599} + m_Text: Pixelate + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &797006602 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 797006599} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &798161389 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 798161390} + - component: {fileID: 798161392} + - component: {fileID: 798161391} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &798161390 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 798161389} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 950130248} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &798161391 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 798161389} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &798161392 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 798161389} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &798901403 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 798901404} + - component: {fileID: 798901406} + - component: {fileID: 798901405} + m_Layer: 0 + m_Name: Flag + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &798901404 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 798901403} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 1.132, y: 0.846, z: 0.1} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 935289136} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &798901405 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 798901403} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &798901406 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 798901403} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 208665463} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300002, guid: adce45105552071409c959137cb5b670, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 2.18, y: 1.76} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &799318215 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 799318216} + - component: {fileID: 799318218} + - component: {fileID: 799318217} + - component: {fileID: 799318219} + m_Layer: 0 + m_Name: FireMid + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &799318216 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 799318215} + m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: -0.025} + m_LocalScale: {x: 1.0754969, y: 1.0754969, z: 1.0754969} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 102412577} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} +--- !u!114 &799318217 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 799318215} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &799318218 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 799318215} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 1c2c3a51f881cb443906a57116cf56fe, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 2ea3ea54c499d314f957e0a47dc11c9c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.04, y: 0.04} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &799318219 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 799318215} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 384dba07353e1f242b467b6857a1e3d4, type: 3} + m_Name: + m_EditorClassIdentifier: + numericPropertyName: _RotateUvAmount + scrollSpeed: 7.5 + applyModulo: 1 + modulo: 6.28 + mat: {fileID: 0} +--- !u!1 &816448198 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 816448199} + - component: {fileID: 816448201} + - component: {fileID: 816448200} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &816448199 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 816448198} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1358020792} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &816448200 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 816448198} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &816448201 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 816448198} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &817315606 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - NEGATIVE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &820886077 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 820886078} + - component: {fileID: 820886080} + - component: {fileID: 820886079} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &820886078 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 820886077} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 420059981} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &820886079 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 820886077} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &820886080 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 820886077} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &822200767 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - FLICKER_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0.221 + - _FlickerFreq: 0.31 + - _FlickerPercent: 0.132 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &831340857 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 831340858} + - component: {fileID: 831340861} + - component: {fileID: 831340860} + - component: {fileID: 831340859} + m_Layer: 0 + m_Name: Aura + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &831340858 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 831340857} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.05} + m_LocalScale: {x: 1.009596, y: 1.009596, z: 1.009596} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 982048496} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &831340859 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 831340857} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &831340860 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 831340857} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &831340861 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 831340857} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1774397170} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &834551330 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 834551331} + - component: {fileID: 834551333} + - component: {fileID: 834551332} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &834551331 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 834551330} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 595151377} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &834551332 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 834551330} + m_Text: Pattern + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &834551333 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 834551330} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &844328744 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 844328745} + - component: {fileID: 844328747} + - component: {fileID: 844328746} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &844328745 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 844328744} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1447921189} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &844328746 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 844328744} + m_Text: Flicker + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &844328747 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 844328744} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &846281938 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 846281939} + - component: {fileID: 846281941} + - component: {fileID: 846281940} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &846281939 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 846281938} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 419407226} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &846281940 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 846281938} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &846281941 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 846281938} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &849687024 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 849687025} + - component: {fileID: 849687027} + - component: {fileID: 849687026} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &849687025 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 849687024} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 419407226} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &849687026 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 849687024} + m_Text: Textured Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &849687027 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 849687024} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &857099421 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 857099422} + - component: {fileID: 857099424} + - component: {fileID: 857099423} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &857099422 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 857099421} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 972134371} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &857099423 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 857099421} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &857099424 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 857099421} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &858113521 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 858113522} + - component: {fileID: 858113524} + - component: {fileID: 858113523} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &858113522 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 858113521} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1813870144} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &858113523 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 858113521} + m_Text: Chromatic Aberration + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &858113524 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 858113521} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &866812739 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 866812740} + - component: {fileID: 866812742} + - component: {fileID: 866812741} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &866812740 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 866812739} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1120052622} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &866812741 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 866812739} + m_Text: Glow + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &866812742 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 866812739} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &878272796 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 878272797} + - component: {fileID: 878272799} + - component: {fileID: 878272798} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &878272797 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 878272796} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1767383824} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &878272798 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 878272796} + m_Text: Blur + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &878272799 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 878272796} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &883004836 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORSWAP_ON + - GLOWTEX_ON + - GLOW_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - OUTDIST_ON + - OUTTEX_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + - _OUTLINEDISTORTTOGGLE_ON + - _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: f96aebb9bcd1e3b44bafbb23b1bdac88, type: 3} + m_Scale: {x: 3, y: 3} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1.5, y: 1.5} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.128 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 6.1 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.05 + - _OutlineDistortTexXSpeed: 2 + - _OutlineDistortTexYSpeed: -14.6 + - _OutlineDistortToggle: 1 + - _OutlineGlow: 10.4 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 1 + - _OutlineTexYSpeed: -4 + - _OutlineWidth: 0.031 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 8.95 + - _WaveSpeed: 12.14 + - _WaveStrength: 18.77 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.3490566, g: 0.3490566, b: 0.3490566, a: 1} + - _ColorSwapGreen: {r: 1, g: 0.11792451, b: 0.11792451, a: 1} + - _ColorSwapRed: {r: 0.6603774, g: 0.6603774, b: 0.6603774, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.11320752, b: 0.11320752, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.122641504, b: 0.122641504, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &892560182 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 892560183} + - component: {fileID: 892560185} + - component: {fileID: 892560184} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &892560183 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 892560182} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1286689243} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &892560184 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 892560182} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &892560185 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 892560182} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &906963583 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 906963584} + - component: {fileID: 906963586} + - component: {fileID: 906963585} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &906963584 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 906963583} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 982048496} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &906963585 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 906963583} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &906963586 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 906963583} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &912083091 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 912083092} + - component: {fileID: 912083094} + - component: {fileID: 912083093} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &912083092 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 912083091} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1554650441} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &912083093 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 912083091} + m_Text: Wave + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &912083094 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 912083091} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &913568438 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 913568439} + - component: {fileID: 913568441} + - component: {fileID: 913568440} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &913568439 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 913568438} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1050471976} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &913568440 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 913568438} + m_Text: Fill Amount + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &913568441 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 913568438} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &916295327 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CHROMABERR_ON + - FISHEYE_ON + - HITEFFECT_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - PINCH_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.249 + - _ChromAberrAmount: 0 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 224 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 2 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0107 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.9094448, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &924727830 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 924727831} + - component: {fileID: 924727833} + - component: {fileID: 924727832} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &924727831 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 924727830} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 166039413} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &924727832 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 924727830} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &924727833 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 924727830} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &928177172 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 928177173} + - component: {fileID: 928177175} + - component: {fileID: 928177174} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &928177173 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 928177172} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 242385329} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &928177174 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 928177172} + m_Text: Water + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &928177175 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 928177172} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &933861177 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 933861178} + - component: {fileID: 933861180} + - component: {fileID: 933861179} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &933861178 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933861177} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1554650441} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &933861179 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933861177} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &933861180 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933861177} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &935289135 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 935289136} + - component: {fileID: 935289137} + m_Layer: 0 + m_Name: FlagPole + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &935289136 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935289135} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 798901404} + m_Father: {fileID: 1883979700} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &935289137 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935289135} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: adce45105552071409c959137cb5b670, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1.26, y: 4.34} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &939106331 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 939106332} + - component: {fileID: 939106333} + m_Layer: 0 + m_Name: MotionBlur + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &939106332 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 939106331} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 210, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 671117226} + - {fileID: 2023359958} + - {fileID: 298142067} + m_Father: {fileID: 2036092933} + m_RootOrder: 21 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &939106333 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 939106331} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &941567972 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 941567973} + - component: {fileID: 941567975} + - component: {fileID: 941567974} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &941567973 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 941567972} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1313138820} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &941567974 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 941567972} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &941567975 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 941567972} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &942262412 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 942262413} + - component: {fileID: 942262415} + - component: {fileID: 942262414} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &942262413 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 942262412} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 242385329} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &942262414 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 942262412} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &942262415 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 942262412} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &944684572 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 944684573} + - component: {fileID: 944684575} + - component: {fileID: 944684576} + - component: {fileID: 944684577} + m_Layer: 0 + m_Name: Posterize + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &944684573 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 944684572} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 190, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1357243700} + - {fileID: 1497593394} + m_Father: {fileID: 2036092933} + m_RootOrder: 19 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &944684575 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 944684572} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 302907434} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &944684576 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 944684572} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!95 &944684577 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 944684572} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: e25fb0db751a59a43bb4bd01628feb7e, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!1 &945953420 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 945953421} + - component: {fileID: 945953423} + - component: {fileID: 945953422} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &945953421 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 945953420} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1861014113} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &945953422 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 945953420} + m_Text: (Has Sprite Mask) + m_OffsetZ: -1.5 + m_CharacterSize: 0.06 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &945953423 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 945953420} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &946451345 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORRAMP_ON + - FISHEYE_ON + - INNEROUTLINE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 2eb26501acf862843a55a2e79af0c3c8, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0.2 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 5.27 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.252 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.1 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 250 + - _InnerOutlineThickness: 3 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1.98 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 0, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 1, b: 1, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 1, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 0, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &950130247 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 950130248} + - component: {fileID: 950130250} + m_Layer: 0 + m_Name: Grass + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &950130248 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 950130247} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 150, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 124794631} + - {fileID: 1023365940} + - {fileID: 798161390} + m_Father: {fileID: 1563905016} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &950130250 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 950130247} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &950928387 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - HITEFFECT_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 10 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 0.08018869, b: 0.08018869, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &972134370 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 972134371} + - component: {fileID: 972134374} + - component: {fileID: 972134373} + m_Layer: 0 + m_Name: Distortion + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &972134371 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 972134370} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 100, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 305999441} + - {fileID: 857099422} + m_Father: {fileID: 1351315063} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &972134373 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 972134370} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &972134374 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 972134370} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1333622421} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &982048495 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 982048496} + - component: {fileID: 982048499} + - component: {fileID: 982048498} + m_Layer: 0 + m_Name: SuperSaiyan + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &982048496 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 982048495} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 310, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 831340858} + - {fileID: 1432462163} + - {fileID: 906963584} + m_Father: {fileID: 1563905016} + m_RootOrder: 31 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &982048498 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 982048495} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &982048499 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 982048495} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2023436102} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &984096427 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 984096428} + - component: {fileID: 984096430} + - component: {fileID: 984096431} + m_Layer: 0 + m_Name: Gradient + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &984096428 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 80, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 624559471} + - {fileID: 1418206287} + m_Father: {fileID: 2036092933} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &984096430 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 111852238} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &984096431 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &984421900 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - ZOOMUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.09 + - _ColorSwapRedLuminosity: 0.604 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapRed: {r: 0, g: 0.5643088, b: 0.8396226, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &998349593 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 998349594} + - component: {fileID: 998349596} + - component: {fileID: 998349595} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &998349594 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 998349593} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1358020792} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &998349595 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 998349593} + m_Text: Warp + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &998349596 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 998349593} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &999359662 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - SHAKEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &999529076 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 999529080} + - component: {fileID: 999529079} + - component: {fileID: 999529077} + - component: {fileID: 999529082} + - component: {fileID: 999529081} + m_Layer: 4 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &999529077 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 999529076} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fcb2e887baa071545bad04c7b0e87cce, type: 3} + m_Name: + m_EditorClassIdentifier: + targetedItem: {fileID: 4825911116503289154} + demoController: {fileID: 732186309} + speed: 10 +--- !u!20 &999529079 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 999529076} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 1 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &999529080 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 999529076} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &999529081 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 999529076} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3} + m_Name: + m_EditorClassIdentifier: + sharedProfile: {fileID: 11400000, guid: c12f806a2a3ae954ebb1771c65441e4c, type: 2} + isGlobal: 1 + blendDistance: 0 + weight: 1 + priority: 0 +--- !u!114 &999529082 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 999529076} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} + m_Name: + m_EditorClassIdentifier: + volumeTrigger: {fileID: 999529080} + volumeLayer: + serializedVersion: 2 + m_Bits: 16 + stopNaNPropagation: 1 + finalBlitToCameraTarget: 0 + antialiasingMode: 0 + temporalAntialiasing: + jitterSpread: 0.75 + sharpness: 0.25 + stationaryBlending: 0.95 + motionBlending: 0.85 + subpixelMorphologicalAntialiasing: + quality: 2 + fastApproximateAntialiasing: + fastMode: 0 + keepAlpha: 0 + fog: + enabled: 1 + excludeSkybox: 1 + debugLayer: + lightMeter: + width: 512 + height: 256 + showCurves: 1 + histogram: + width: 512 + height: 256 + channel: 3 + waveform: + exposure: 0.12 + height: 256 + vectorscope: + size: 256 + exposure: 0.12 + overlaySettings: + linearDepth: 0 + motionColorIntensity: 4 + motionGridSize: 64 + colorBlindnessType: 0 + colorBlindnessStrength: 1 + m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2} + m_ShowToolkit: 0 + m_ShowCustomSorter: 0 + breakBeforeColorGrading: 0 + m_BeforeTransparentBundles: [] + m_BeforeStackBundles: [] + m_AfterStackBundles: [] +--- !u!1 &1005972826 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1005972827} + - component: {fileID: 1005972829} + - component: {fileID: 1005972828} + m_Layer: 5 + m_Name: ExpositorTitle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1005972827 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1005972826} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 535274222} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 9.384888} + m_SizeDelta: {x: 160, y: 121.23} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1005972828 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1005972826} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: d722354f9c8e9e643b5f30f00b5b20ea, type: 3} + m_FontSize: 123 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 123 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: Color Effects +--- !u!222 &1005972829 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1005972826} + m_CullTransparentMesh: 0 +--- !u!1 &1022452600 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1022452601} + - component: {fileID: 1022452603} + - component: {fileID: 1022452602} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1022452601 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1022452600} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 47460684} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1022452602 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1022452600} + m_Text: Colors + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1022452603 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1022452600} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1023365939 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1023365940} + - component: {fileID: 1023365942} + - component: {fileID: 1023365941} + m_Layer: 0 + m_Name: GrassSprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1023365940 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1023365939} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0.4, z: 0} + m_LocalScale: {x: 0.66693, y: 0.66693, z: 0.66693} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 950130248} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1023365941 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1023365939} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1023365942 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1023365939} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1820263336} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: cf7e1f6ebb800154db2b215cba9330ee, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 10.24, y: 3.06} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1024727761 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLOW_ON + - GRADIENT_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 6.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0.054901965, g: 0, b: 0.011764707, a: 1} + - _GradBotRightCol: {r: 0.05660379, g: 0, b: 0.013662981, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1028271462 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1028271463} + - component: {fileID: 1028271465} + - component: {fileID: 1028271466} + m_Layer: 0 + m_Name: Pixelate + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1028271463 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1028271462} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 170, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 797006600} + - {fileID: 322195378} + m_Father: {fileID: 2036092933} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1028271465 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1028271462} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1708657337} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1028271466 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1028271462} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1038353158 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1038353159} + - component: {fileID: 1038353162} + - component: {fileID: 1038353161} + - component: {fileID: 1038353163} + m_Layer: 0 + m_Name: Impact + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1038353159 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 70, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1188655027} + - {fileID: 1282385917} + m_Father: {fileID: 1563905016} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1038353161 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1038353162 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 916295327} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &1038353163 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: a1097444efe6cb54f86e2955982c0fe1, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!1 &1039947232 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1039947233} + - component: {fileID: 1039947235} + - component: {fileID: 1039947234} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1039947233 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1039947232} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 786925991} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1039947234 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1039947232} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1039947235 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1039947232} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &1041891245 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - TWISTUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 10 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 0.08018869, b: 0.08018869, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1045875747 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORSWAP_ON + - GLOWTEX_ON + - INNEROUTLINE_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - WAVEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.1, y: 0.1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 4abae6e7a5c534a4c8e95edf12a7d0c9, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: -0.01 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.28 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1.44 + - _CullingOption: 0 + - _DistortAmount: 0.2 + - _DistortTexXSpeed: 1 + - _DistortTexYSpeed: 1 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 0 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 6 + - _InnerOutlineThickness: 1.31 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 5.1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.096 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 0.38 + - _RoundWaveStrength: 0.063 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7.8 + - _WaveSpeed: 9.4 + - _WaveStrength: 22.4 + - _WaveX: 0.5 + - _WaveY: 0.469 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.92 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.6981132, g: 0.8099337, b: 1, a: 1} + - _ColorSwapGreen: {r: 0.98823535, g: 0.6392157, b: 0.6117647, a: 1} + - _ColorSwapRed: {r: 0.5176471, g: 0.63529414, b: 0.81568635, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.98823535, g: 0.6392157, b: 0.6117647, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 0.9811321, g: 0.29619083, b: 0.7939467, a: 1} + - _OutlineColor: {r: 0.5896226, g: 0.1792453, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1050471975 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1050471976} + - component: {fileID: 1050471980} + - component: {fileID: 1050471979} + - component: {fileID: 1050471977} + m_Layer: 0 + m_Name: Fill Amount + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1050471976 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1050471975} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 60, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 913568439} + - {fileID: 367923811} + m_Father: {fileID: 1351315063} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1050471977 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1050471975} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 6078cf4809fc6174f90700135dcf328f, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &1050471979 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1050471975} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1050471980 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1050471975} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 323921624} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1065071623 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - BLUR_ON + - COLORRAMP_ON + - GLOW_ON + - NEGATIVE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 763e13699209a614b8800c76fc9dee48, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: -0.238 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 0.5 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1071386687 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1071386688} + - component: {fileID: 1071386690} + - component: {fileID: 1071386689} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1071386688 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1071386687} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1227823621} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1071386689 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1071386687} + m_Text: Shake + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1071386690 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1071386687} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1073566155 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1073566156} + - component: {fileID: 1073566159} + - component: {fileID: 1073566158} + m_Layer: 0 + m_Name: Contrast + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1073566156 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073566155} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 290, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1462418353} + - {fileID: 1267243997} + m_Father: {fileID: 2036092933} + m_RootOrder: 29 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1073566158 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073566155} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1073566159 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073566155} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1693197524} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &1073973762 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 50, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1850969167} + - {fileID: 510732448} + m_Father: {fileID: 2036092933} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1073973763 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1073973762} + - component: {fileID: 1073973765} + - component: {fileID: 1073973766} + m_Layer: 0 + m_Name: Outline3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &1073973765 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1129192189} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1073973766 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1078024312 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - INNEROUTLINE_ON + - ONLYINNEROUTLINE_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - SHADOW_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _ONLYINNEROUTLINE_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 5 + - _InnerOutlineThickness: 1.6 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 1 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 6.3 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.01 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 1 + - _ShadowX: 0 + - _ShadowY: 0 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 0.4811321, b: 0.4811321, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1078196206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1078196207} + - component: {fileID: 1078196209} + - component: {fileID: 1078196208} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1078196207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1078196206} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 511167261} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1078196208 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1078196206} + m_Text: Ice Soldier + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1078196209 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1078196206} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1090919392 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1090919393} + - component: {fileID: 1090919395} + - component: {fileID: 1090919394} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1090919393 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1090919392} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1986728942} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1090919394 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1090919392} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1090919395 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1090919392} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1091797525 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1091797526} + - component: {fileID: 1091797528} + - component: {fileID: 1091797527} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1091797526 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1091797525} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1953432852} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1091797527 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1091797525} + m_Text: Fire + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1091797528 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1091797525} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1097188549 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1097188550} + - component: {fileID: 1097188552} + - component: {fileID: 1097188551} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1097188550 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1097188549} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1883979700} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1097188551 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1097188549} + m_Text: Flag + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1097188552 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1097188549} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1100636067 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1100636068} + - component: {fileID: 1100636070} + - component: {fileID: 1100636069} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1100636068 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1100636067} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 166039413} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1100636069 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1100636067} + m_Text: Round Wave + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1100636070 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1100636067} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1103527057 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1103527058} + - component: {fileID: 1103527060} + - component: {fileID: 1103527059} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1103527058 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1103527057} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2096881075} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1103527059 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1103527057} + m_Text: Shiny Marine + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1103527060 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1103527057} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &1105303541 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - SHADOW_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1111461196 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1111461197} + - component: {fileID: 1111461200} + - component: {fileID: 1111461199} + m_Layer: 0 + m_Name: Pinch + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1111461197 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1111461196} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 160, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 98690189} + - {fileID: 1325646928} + m_Father: {fileID: 1351315063} + m_RootOrder: 16 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1111461199 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1111461196} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1111461200 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1111461196} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1863638619} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1113550344 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1113550345} + - component: {fileID: 1113550347} + - component: {fileID: 1113550346} + - component: {fileID: 1113550348} + m_Layer: 0 + m_Name: Soldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1113550345 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1113550344} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.549, z: -0.35} + m_LocalScale: {x: 0.62497, y: 0.62497, z: 0.62497} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2035943844} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1113550346 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1113550344} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1113550347 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1113550344} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 611714447} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &1113550348 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1113550344} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 2f06abfb8d5c7014299913ef4dbc450d, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!1 &1117637835 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1117637836} + - component: {fileID: 1117637838} + - component: {fileID: 1117637837} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1117637836 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1117637835} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1528149039} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1117637837 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1117637835} + m_Text: 'Jelly Fish Soldier + +' + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1117637838 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1117637835} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &1118634257 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - RADIALCLIPPING_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 1.5 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 0 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1119325821 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1119325822} + - component: {fileID: 1119325826} + - component: {fileID: 1119325825} + - component: {fileID: 1119325823} + m_Layer: 0 + m_Name: Twist + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1119325822 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 120, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1697898091} + - {fileID: 793013508} + m_Father: {fileID: 1351315063} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1119325823 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: ed827ed402dcef3458313b21158b5c7c, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &1119325825 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1119325826 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1041891245} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &1120052622 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120052623} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 866812740} + - {fileID: 136921169} + m_Father: {fileID: 2036092933} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1120052623 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1120052622} + - component: {fileID: 1120052625} + - component: {fileID: 1120052626} + m_Layer: 0 + m_Name: Glow + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &1120052625 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120052623} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1319594099} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1120052626 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120052623} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1120148260 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1120148261} + - component: {fileID: 1120148263} + - component: {fileID: 1120148262} + m_Layer: 0 + m_Name: CustomTransparentSortingAxisText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1120148261 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120148260} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.55, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1120148262 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120148260} + m_Text: '(Needs Cutom Transparent + + Sorting Axis 0,0,1)' + m_OffsetZ: -1.5 + m_CharacterSize: 0.05 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 1 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1120148263 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120148260} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1120672004 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1120672005} + - component: {fileID: 1120672007} + - component: {fileID: 1120672006} + m_Layer: 0 + m_Name: Front + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1120672005 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120672004} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0.02} + m_LocalScale: {x: 0.9196, y: 0.65, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 540070583} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1120672006 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120672004} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1120672007 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1120672004} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2067098021} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: fab06e0be9375cc4d823efa71629885c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1123731222 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1123731223} + - component: {fileID: 1123731226} + - component: {fileID: 1123731225} + m_Layer: 0 + m_Name: Overlay Texture + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1123731223 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1123731222} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 300, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 355247223} + - {fileID: 297942435} + m_Father: {fileID: 2036092933} + m_RootOrder: 30 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1123731225 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1123731222} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1123731226 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1123731222} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1936528753} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1129192189 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - OUTBASE8DIR_ON + - OUTBASE_ON + - OUTDIST_ON + - OUTTEX_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + - _OUTLINEDISTORTTOGGLE_ON + - _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 806e236bc12668e4da974bb8f536d28f, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.17 + - _OutlineDistortTexXSpeed: 2 + - _OutlineDistortTexYSpeed: -7 + - _OutlineDistortToggle: 1 + - _OutlineGlow: 6.4 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 0 + - _OutlineTexYSpeed: -10 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1146988137 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1146988138} + - component: {fileID: 1146988140} + - component: {fileID: 1146988139} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1146988138 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1146988137} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1988936578} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1146988139 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1146988137} + m_Text: (Texture) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1146988140 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1146988137} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &1150284212 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - FISHEYE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.338 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1166912798 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CHANGECOLOR_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0.539 + - _ColorChangeTolerance: 0.75 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 0.70980394, g: 0.15686275, b: 0.2901961, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1181865632 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLITCH_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 4 + - _GlitchSize: 1.23 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1183578089 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1183578090} + - component: {fileID: 1183578092} + - component: {fileID: 1183578091} + m_Layer: 0 + m_Name: Outline2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1183578090 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1183578089} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.22, y: 0.82, z: 0.05} + m_LocalScale: {x: 1.0080961, y: 1.0080961, z: 1.0080961} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1183578091 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1183578089} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 0 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1183578092 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1183578089} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 2fff2435ee99439438c463e2ce768283, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1188655026 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1188655027} + - component: {fileID: 1188655029} + - component: {fileID: 1188655028} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1188655027 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1188655026} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1038353159} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1188655028 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1188655026} + m_Text: Impact + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1188655029 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1188655026} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1194409626 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1194409627} + - component: {fileID: 1194409629} + - component: {fileID: 1194409628} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1194409627 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194409626} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2045252512} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1194409628 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194409626} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1194409629 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194409626} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &1195370958 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - DISTORT_ON + - GLOW_ON + - GREYSCALE_ON + - POLARUV_ON + - POSTERIZE_ON + - TEXTURESCROLL_ON + - WAVEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 2, y: 2} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 4.5} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 1.167 + - _DistortTexXSpeed: 10 + - _DistortTexYSpeed: 10 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 1.5 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: -0.119 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 12.7 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 0.94 + - _HsvSaturation: 1.14 + - _HsvShift: 41 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 22 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 9.9 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 0.1 + - _ShakeUvX: 0 + - _ShakeUvY: 5 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 0.17 + - _TextureScrollYSpeed: 1.47 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 18.68 + - _WaveSpeed: 19 + - _WaveStrength: 13.8 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0.083333254, g: 1, b: 0, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1201459352 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - BLUR_ON + - CLIPPING_ON + - DISTORT_ON + - GLOW_ON + - WAVEUV_ON + - WIND_ON + m_InvalidKeywords: + - CUSTOMBLENDING_ON + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: dd5ae95e1fbf31c4ca76212884f5b8fc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 100 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0.03 + - _ClipUvRight: 0 + - _ClipUvUp: 0.042 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.81 + - _DistortTexXSpeed: -1 + - _DistortTexYSpeed: -5.9 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 14.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 9 + - _GrassWind: 5.8 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 0.4339623, g: 0.08552541, b: 0, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.30916578, b: 0.13207549, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1202972139 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1202972141} + - component: {fileID: 1202972140} + m_Layer: 0 + m_Name: Urp-Volume + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1202972140 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1202972139} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Core.Runtime::UnityEngine.Rendering.Volume + m_IsGlobal: 1 + priority: 0 + blendDistance: 0 + weight: 1 + sharedProfile: {fileID: 11400000, guid: 93a6cccfd37450b4fbd8eec2f4cc77f4, type: 2} +--- !u!4 &1202972141 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1202972139} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1211354476 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1211354477} + - component: {fileID: 1211354479} + m_Layer: 0 + m_Name: HP Bar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1211354477 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1211354476} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 180, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1697295737} + - {fileID: 1404112919} + - {fileID: 540070583} + m_Father: {fileID: 1563905016} + m_RootOrder: 18 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1211354479 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1211354476} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1213636577 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - OUTBASE8DIR_ON + - ROUNDWAVEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0159 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2.82 + - _RoundWaveStrength: 0.421 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 8.95 + - _WaveSpeed: 12.14 + - _WaveStrength: 18.77 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1227823620 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1227823621} + - component: {fileID: 1227823624} + - component: {fileID: 1227823623} + m_Layer: 0 + m_Name: Shake + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1227823621 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1227823620} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 170, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1071386688} + - {fileID: 1484598037} + m_Father: {fileID: 1351315063} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1227823623 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1227823620} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1227823624 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1227823620} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 999359662} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1229041065 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1229041066} + - component: {fileID: 1229041068} + - component: {fileID: 1229041069} + m_Layer: 0 + m_Name: HueShift + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1229041066 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 110, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 294421776} + - {fileID: 2065278700} + m_Father: {fileID: 2036092933} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1229041068 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2061184730} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1229041069 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1230234141 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - TEXTURESCROLL_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0.858 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0.84 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1254156827 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1254156828} + - component: {fileID: 1254156830} + - component: {fileID: 1254156829} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1254156828 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1254156827} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1374997139} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1254156829 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1254156827} + m_Text: Double Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1254156830 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1254156827} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &1257475202 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 0 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1267243996 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1267243997} + - component: {fileID: 1267243999} + - component: {fileID: 1267243998} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1267243997 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1267243996} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1073566156} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1267243998 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1267243996} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1267243999 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1267243996} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1282385916 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1282385917} + - component: {fileID: 1282385919} + - component: {fileID: 1282385918} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1282385917 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1282385916} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1038353159} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1282385918 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1282385916} + m_Text: (Texture is Tiled) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1282385919 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1282385916} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &1283967498 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLOW_ON + - GRADIENT_ON + - HSV_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - SHADOW_ON + - SHINE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0.706 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 0.8 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0.411 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 0 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.009 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.055 + - _ShadowY: 0.054 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 0.5 + - _ShineLocation: 0.481 + - _ShineRotate: 0 + - _ShineWidth: 0.084 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 0.25882354, g: 0.3647059, b: 0.19215688, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1286689242 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1286689243} + - component: {fileID: 1286689245} + - component: {fileID: 1286689246} + m_Layer: 0 + m_Name: Hologram + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1286689243 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1286689242} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 230, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 316897175} + - {fileID: 892560183} + m_Father: {fileID: 2036092933} + m_RootOrder: 23 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1286689245 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1286689242} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 72928926} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1286689246 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1286689242} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1302433541 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1302433542} + - component: {fileID: 1302433544} + - component: {fileID: 1302433543} + m_Layer: 5 + m_Name: Splotch + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1302433542 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1302433541} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.2053999, y: 1.066779, z: 1.148} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 564363701} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 23, y: -40.450073} + m_SizeDelta: {x: 1288.9, y: 199.09998} + m_Pivot: {x: 0.5, y: 1} +--- !u!114 &1302433543 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1302433541} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 51caeab4d98b55046a9013cc2da7e427, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1302433544 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1302433541} + m_CullTransparentMesh: 0 +--- !u!1 &1302959053 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1302959054} + - component: {fileID: 1302959056} + - component: {fileID: 1302959055} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1302959054 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1302959053} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 786925991} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1302959055 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1302959053} + m_Text: Fish Eye + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1302959056 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1302959053} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1308471597 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1308471598} + - component: {fileID: 1308471600} + - component: {fileID: 1308471599} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1308471598 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1308471597} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 694591670} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1308471599 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1308471597} + m_Text: Minimalist Soldier + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1308471600 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1308471597} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1313138819 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1313138820} + - component: {fileID: 1313138823} + - component: {fileID: 1313138822} + m_Layer: 0 + m_Name: Change 1 Color + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1313138820 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1313138819} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 120, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1641593523} + - {fileID: 941567973} + m_Father: {fileID: 2036092933} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1313138822 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1313138819} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1313138823 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1313138819} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1166912798} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1319594099 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLOWTEX_ON + - GLOW_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 7.5 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.58530986, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1325646927 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1325646928} + - component: {fileID: 1325646930} + - component: {fileID: 1325646929} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1325646928 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325646927} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1111461197} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1325646929 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325646927} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1325646930 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1325646927} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1328027727 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1328027728} + - component: {fileID: 1328027730} + - component: {fileID: 1328027729} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1328027728 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1328027727} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1767383824} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1328027729 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1328027727} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1328027730 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1328027727} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1329663899 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1329663900} + - component: {fileID: 1329663903} + - component: {fileID: 1329663902} + m_Layer: 0 + m_Name: Poolar Coords + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1329663900 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1329663899} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 140, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 487308175} + - {fileID: 712974876} + m_Father: {fileID: 1351315063} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1329663902 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1329663899} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1329663903 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1329663899} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 87388692} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1333622421 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - DISTORT_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.34 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1.03 + - _HsvSaturation: 1.262 + - _HsvShift: 251 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1349909629 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLOWTEX_ON + - GLOW_ON + - GRADIENT_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - SHADOW_ON + - TWISTUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 285a35f6ccf7b1a44b6c198e96105173, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 54b37de4aa07caa4797254cf2351058f, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.933 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 1.58 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 18.4 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 0.193 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 3 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 3.2 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0134 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.373 + - _ShadowX: 0.11 + - _ShadowY: 0.014 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1.69 + - _TwistUvPosX: 0.555 + - _TwistUvPosY: 0.531 + - _TwistUvRadius: 0.18 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.043704987, g: 1, b: 0, a: 1} + - _ColorSwapGreen: {r: 1, g: 0.36473382, b: 0, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.017440448, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0.3975923, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.5795412, b: 0.1273585, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1350115730 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1350115731} + - component: {fileID: 1350115734} + - component: {fileID: 1350115733} + m_Layer: 0 + m_Name: Evil Marine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1350115731 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 30, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 601434483} + - {fileID: 789390132} + m_Father: {fileID: 1563905016} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1350115733 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1350115734 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 883004836} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1351315061 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1351315063} + - component: {fileID: 1351315062} + - component: {fileID: 1351315064} + m_Layer: 0 + m_Name: 2.UV Effefcts + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1351315062 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1351315061} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6972382efdee4c642812251660f0c4bb, type: 3} + m_Name: + m_EditorClassIdentifier: + radius: 25 + rotateSpeed: 10 +--- !u!4 &1351315063 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1351315061} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -15, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 56751283} + - {fileID: 1778749804} + - {fileID: 361311995} + - {fileID: 1554650441} + - {fileID: 166039413} + - {fileID: 1901854650} + - {fileID: 1050471976} + - {fileID: 540549269} + - {fileID: 443772011} + - {fileID: 1986728942} + - {fileID: 972134371} + - {fileID: 1358020792} + - {fileID: 1119325822} + - {fileID: 2082220742} + - {fileID: 1329663900} + - {fileID: 786925991} + - {fileID: 1111461197} + - {fileID: 1227823621} + m_Father: {fileID: 732186310} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1351315064 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1351315061} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 681095680e77fad40a6dd907b8ba358b, type: 3} + m_Name: + m_EditorClassIdentifier: + paddingX: 10 +--- !u!1 &1355901850 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1355901851} + - component: {fileID: 1355901853} + - component: {fileID: 1355901852} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1355901851 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1355901850} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1434614528} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1355901852 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1355901850} + m_Text: Negative + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1355901853 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1355901850} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1356966096 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1356966097} + - component: {fileID: 1356966099} + - component: {fileID: 1356966098} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1356966097 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1356966096} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4825911116503289154} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1356966098 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1356966096} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1356966099 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1356966096} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1357243699 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1357243700} + - component: {fileID: 1357243702} + - component: {fileID: 1357243701} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1357243700 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1357243699} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 944684573} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1357243701 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1357243699} + m_Text: Posterize + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1357243702 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1357243699} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1358020791 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1358020792} + - component: {fileID: 1358020795} + - component: {fileID: 1358020794} + m_Layer: 0 + m_Name: Warp + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1358020792 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1358020791} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 110, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 998349594} + - {fileID: 816448199} + m_Father: {fileID: 1351315063} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1358020794 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1358020791} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1358020795 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1358020791} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1769422912} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1363957141 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CHROMABERR_ON + - DOODLE_ON + - FLICKER_ON + - GLITCH_ON + - GLOW_ON + - GREYSCALE_ON + - HOLOGRAM_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.356 + - _ChromAberrAmount: 0.366 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0.4 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.1 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 6 + - _GlitchSize: 1.22 + - _GlitchSpeed: 20 + - _Glow: 5.2 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 7.08 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 2 + - _HologramMinAlpha: 0.167 + - _HologramStripesAlpha: 0.362 + - _HologramStripesAmount: 0.088 + - _HologramStripesFill: 0.334 + - _HologramStripesLuminosity: 1.26 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.03 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.102 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0, g: 0.09171247, b: 0.6698113, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0.4433962, g: 0.4433962, b: 0.4433962, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 0.2841599, b: 0.8490566, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.43268147, b: 0.67058825, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1367380566 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1367380567} + - component: {fileID: 1367380569} + - component: {fileID: 1367380568} + m_Layer: 0 + m_Name: CustomTransparentSortingAxisText (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1367380567 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1367380566} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.6525574, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1478122371} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1367380568 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1367380566} + m_Text: '(Needs Cutom Transparent + + Sorting Axis 0,0,1)' + m_OffsetZ: -1.5 + m_CharacterSize: 0.05 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 1 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1367380569 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1367380566} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1374997138 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1374997139} + - component: {fileID: 1374997143} + - component: {fileID: 1374997142} + m_Layer: 0 + m_Name: DoubleOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1374997139 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1374997138} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 80, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1254156828} + - {fileID: 298228099} + m_Father: {fileID: 1563905016} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1374997142 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1374997138} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1374997143 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1374997138} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1078024312} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1377307553 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CHROMABERR_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.259 + - _ChromAberrAmount: 0.504 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1399293758 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORRAMP_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - TEXTURESCROLL_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 4, y: 4} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 4.3 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.041 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: -1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.5309945, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1402107645 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1402107646} + - component: {fileID: 1402107648} + - component: {fileID: 1402107647} + m_Layer: 0 + m_Name: Sprite1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1402107646 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1402107645} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -1.5, y: 0.82, z: 0} + m_LocalScale: {x: 1.0080961, y: 1.0080961, z: 1.0080961} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1402107647 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1402107645} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 0 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1402107648 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1402107645} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 73084414} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 1 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1404112918 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1404112919} + - component: {fileID: 1404112921} + - component: {fileID: 1404112920} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1404112919 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1404112918} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1211354477} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1404112920 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1404112918} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1404112921 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1404112918} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1415143266 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1415143267} + - component: {fileID: 1415143268} + m_Layer: 0 + m_Name: UnifiedOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1415143267 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1415143266} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 330, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1402107646} + - {fileID: 778370416} + - {fileID: 1521478960} + - {fileID: 1818617670} + - {fileID: 1183578090} + - {fileID: 435111026} + - {fileID: 1924503772} + - {fileID: 1728754561} + - {fileID: 1120148261} + m_Father: {fileID: 1563905016} + m_RootOrder: 33 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1415143268 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1415143266} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1418206286 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1418206287} + - component: {fileID: 1418206289} + - component: {fileID: 1418206288} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1418206287 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1418206286} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 984096428} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1418206288 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1418206286} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1418206289 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1418206286} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1432462162 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1432462163} + - component: {fileID: 1432462165} + - component: {fileID: 1432462164} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1432462163 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1432462162} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 982048496} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1432462164 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1432462162} + m_Text: Super Saiyan + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1432462165 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1432462162} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1434614527 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1434614528} + - component: {fileID: 1434614530} + - component: {fileID: 1434614531} + m_Layer: 0 + m_Name: Negative + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1434614528 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 160, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1355901851} + - {fileID: 352221784} + m_Father: {fileID: 2036092933} + m_RootOrder: 16 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1434614530 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 817315606} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1434614531 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1435312052 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1438024879 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1438024880} + - component: {fileID: 1438024882} + - component: {fileID: 1438024881} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1438024880 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1438024879} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 312669278} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1438024881 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1438024879} + m_Text: AlphaOutline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1438024882 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1438024879} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &1439702669 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - HSV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 27.6 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1.66 + - _HsvShift: 69 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1447921188 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1447921189} + - component: {fileID: 1447921191} + - component: {fileID: 1447921192} + m_Layer: 0 + m_Name: Flicker + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1447921189 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1447921188} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 260, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 844328745} + - {fileID: 1822267181} + m_Father: {fileID: 2036092933} + m_RootOrder: 26 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1447921191 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1447921188} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 822200767} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1447921192 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1447921188} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1450664985 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1450664986} + - component: {fileID: 1450664988} + - component: {fileID: 1450664987} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1450664986 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1450664985} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1923390774} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1450664987 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1450664985} + m_Text: 'Radial Gradient + +' + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1450664988 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1450664985} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1454273601 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1454273602} + - component: {fileID: 1454273604} + - component: {fileID: 1454273603} + - component: {fileID: 1454273605} + m_Layer: 0 + m_Name: FireFront + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1454273602 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1454273601} + m_LocalRotation: {x: 0, y: 0, z: 1, w: 0} + m_LocalPosition: {x: 0, y: 0, z: -0.05} + m_LocalScale: {x: 0.66255665, y: 0.66255665, z: 0.66255665} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 102412577} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180} +--- !u!114 &1454273603 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1454273601} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1454273604 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1454273601} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 1c2c3a51f881cb443906a57116cf56fe, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 2ea3ea54c499d314f957e0a47dc11c9c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.04, y: 0.04} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1454273605 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1454273601} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 384dba07353e1f242b467b6857a1e3d4, type: 3} + m_Name: + m_EditorClassIdentifier: + numericPropertyName: _RotateUvAmount + scrollSpeed: 10 + applyModulo: 1 + modulo: 6.28 + mat: {fileID: 0} +--- !u!21 &1459191230 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - ATLAS_ON + - CHANGECOLOR_ON + - DOODLE_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0.706 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 6.6 + - _HandDrawnSpeed: 6.13 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 0.49902344 + - _MaxYUV: 0.95703125 + - _MinXUV: 0.068359375 + - _MinYUV: 0.48339844 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.016 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 0.25882354, g: 0.3647059, b: 0.19215688, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1462418352 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1462418353} + - component: {fileID: 1462418355} + - component: {fileID: 1462418354} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1462418353 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1462418352} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1073566156} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1462418354 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1462418352} + m_Text: Contrast + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1462418355 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1462418352} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1464450238 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1464450239} + - component: {fileID: 1464450241} + - component: {fileID: 1464450240} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1464450239 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1464450238} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 584220654} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1464450240 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1464450238} + m_Text: Thermal Vision + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1464450241 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1464450238} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1466512395 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1466512396} + - component: {fileID: 1466512398} + - component: {fileID: 1466512397} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1466512396 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1466512395} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 694591670} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1466512397 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1466512395} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1466512398 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1466512395} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1471800764 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1471800765} + - component: {fileID: 1471800767} + - component: {fileID: 1471800766} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1471800765 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1471800764} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 368348656} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1471800766 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1471800764} + m_Text: Ghost + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1471800767 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1471800764} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1478122370 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1478122371} + - component: {fileID: 1478122374} + - component: {fileID: 1478122373} + m_Layer: 0 + m_Name: OutlineAlwaysVisible + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1478122371 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1478122370} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 370, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2134460149} + - {fileID: 326244155} + - {fileID: 1848773095} + - {fileID: 1367380567} + - {fileID: 482750999} + m_Father: {fileID: 1563905016} + m_RootOrder: 37 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1478122373 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1478122370} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1478122374 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1478122370} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1435312052} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1484598036 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1484598037} + - component: {fileID: 1484598039} + - component: {fileID: 1484598038} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1484598037 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1484598036} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1227823621} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1484598038 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1484598036} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1484598039 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1484598036} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1497593393 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1497593394} + - component: {fileID: 1497593396} + - component: {fileID: 1497593395} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1497593394 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1497593393} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 944684573} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1497593395 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1497593393} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1497593396 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1497593393} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1507269761 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1507269762} + - component: {fileID: 1507269766} + - component: {fileID: 1507269765} + - component: {fileID: 1507269763} + m_Layer: 0 + m_Name: Twist Disappear + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1507269762 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 50, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1939573377} + m_Father: {fileID: 1563905016} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1507269763 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: fe198228e3a49df4b966ab214ec9cde5, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &1507269765 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1507269766 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1912112097} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1510314497 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1510314498} + - component: {fileID: 1510314500} + - component: {fileID: 1510314499} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1510314498 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1510314497} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1687594936} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1510314499 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1510314497} + m_Text: Alpha Cutoff + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1510314500 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1510314497} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1511231069 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1511231070} + - component: {fileID: 1511231072} + - component: {fileID: 1511231071} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1511231070 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1511231069} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 290590332} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1511231071 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1511231069} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1511231072 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1511231069} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1521478959 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1521478960} + - component: {fileID: 1521478962} + - component: {fileID: 1521478961} + m_Layer: 0 + m_Name: Sprite3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1521478960 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1521478959} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.11, y: -0.66, z: -0.1} + m_LocalScale: {x: 1.0657709, y: 1.0657709, z: 1.0657709} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1521478961 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1521478959} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 0 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1521478962 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1521478959} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2007448611} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1522371943 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1522371944} + - component: {fileID: 1522371946} + - component: {fileID: 1522371945} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1522371944 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522371943} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 746759203} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1522371945 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522371943} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1522371946 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1522371943} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1523182284 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1523182285} + - component: {fileID: 1523182287} + - component: {fileID: 1523182286} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1523182285 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1523182284} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1861014113} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1523182286 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1523182284} + m_Text: Burning Soldier + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1523182287 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1523182284} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1527473306 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1527473307} + - component: {fileID: 1527473309} + - component: {fileID: 1527473308} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1527473307 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1527473306} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 511167261} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1527473308 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1527473306} + m_Text: (Sprite Mask and Particles) + m_OffsetZ: -1.5 + m_CharacterSize: 0.05 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1527473309 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1527473306} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1528149038 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1528149039} + - component: {fileID: 1528149042} + - component: {fileID: 1528149041} + m_Layer: 0 + m_Name: JellyFishSoldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1528149039 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1528149038} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 240, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1117637836} + - {fileID: 1881847164} + m_Father: {fileID: 1563905016} + m_RootOrder: 24 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1528149041 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1528149038} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1528149042 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1528149038} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1045875747} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1537019967 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GRADIENT_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 14.9 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 0 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.047169805, g: 0.047169805, b: 0.047169805, a: 1} + - _GradBotLeftCol: {r: 0.1792453, g: 0.1792453, b: 0.1792453, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 0, a: 1} + - _GradTopLeftCol: {r: 0.754717, g: 0.754717, b: 0.754717, a: 1} + - _GradTopRightCol: {r: 0.3207547, g: 0.3197579, b: 0.3192417, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1554650440 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1554650441} + - component: {fileID: 1554650444} + - component: {fileID: 1554650443} + m_Layer: 0 + m_Name: Wave + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1554650441 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1554650440} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 30, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 912083092} + - {fileID: 933861178} + m_Father: {fileID: 1351315063} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1554650443 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1554650440} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1554650444 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1554650440} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1984207367} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1562540216 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1562540217} + - component: {fileID: 1562540219} + - component: {fileID: 1562540218} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1562540217 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1562540216} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1901854650} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1562540218 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1562540216} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1562540219 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1562540216} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1563905014 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1563905016} + - component: {fileID: 1563905015} + - component: {fileID: 1563905017} + m_Layer: 0 + m_Name: 3.Effect Combinations + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1563905015 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1563905014} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6972382efdee4c642812251660f0c4bb, type: 3} + m_Name: + m_EditorClassIdentifier: + radius: 45 + rotateSpeed: 10 +--- !u!4 &1563905016 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1563905014} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -30, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1934762264} + - {fileID: 2045252512} + - {fileID: 252177636} + - {fileID: 1350115731} + - {fileID: 1875180451} + - {fileID: 1507269762} + - {fileID: 1675838108} + - {fileID: 1038353159} + - {fileID: 1374997139} + - {fileID: 766050008} + - {fileID: 47460684} + - {fileID: 353408739} + - {fileID: 595151377} + - {fileID: 2035943844} + - {fileID: 1756331349} + - {fileID: 950130248} + - {fileID: 242385329} + - {fileID: 1953432852} + - {fileID: 1211354477} + - {fileID: 1883979700} + - {fileID: 642204093} + - {fileID: 102412577} + - {fileID: 4005302481246734412} + - {fileID: 407134450} + - {fileID: 1528149039} + - {fileID: 42135250} + - {fileID: 357954209} + - {fileID: 499272004} + - {fileID: 2096881075} + - {fileID: 450696184} + - {fileID: 694591670} + - {fileID: 982048496} + - {fileID: 584220654} + - {fileID: 1415143267} + - {fileID: 1861014113} + - {fileID: 511167261} + - {fileID: 1893925001} + - {fileID: 1478122371} + m_Father: {fileID: 732186310} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1563905017 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1563905014} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 681095680e77fad40a6dd907b8ba358b, type: 3} + m_Name: + m_EditorClassIdentifier: + paddingX: 10 +--- !u!1 &1571920278 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1571920279} + - component: {fileID: 1571920281} + - component: {fileID: 1571920280} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1571920279 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1571920278} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4825911116503289154} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1571920280 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1571920278} + m_Text: Original Sprite + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1571920281 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1571920278} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1586363707 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1586363708} + - component: {fileID: 1586363710} + - component: {fileID: 1586363709} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1586363708 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1586363707} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 102412577} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1586363709 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1586363707} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1586363710 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1586363707} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1601051769 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1601051770} + - component: {fileID: 1601051772} + - component: {fileID: 1601051771} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1601051770 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1601051769} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1778749804} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1601051771 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1601051769} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1601051772 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1601051769} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &1605957010 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - OFFSETUV_ON + - OUTBASE8DIR_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + - _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0137 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!4 &1613686741 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1613686742} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 20, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 453652828} + - {fileID: 1706778797} + m_Father: {fileID: 2036092933} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1613686742 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1613686741} + - component: {fileID: 1613686744} + - component: {fileID: 1613686745} + - component: {fileID: 1613686746} + m_Layer: 0 + m_Name: Fade + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &1613686744 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1613686742} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 772177650} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1613686745 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1613686742} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!95 &1613686746 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1613686742} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 2025469cc6b8be543a1b93993e746b75, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!1 &1618143721 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1618143722} + - component: {fileID: 1618143724} + - component: {fileID: 1618143723} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1618143722 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1618143721} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 443772011} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1618143723 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1618143721} + m_Text: Texture Scroll + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1618143724 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1618143721} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1641593522 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1641593523} + - component: {fileID: 1641593525} + - component: {fileID: 1641593524} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1641593523 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1641593522} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1313138820} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1641593524 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1641593522} + m_Text: Change 1 Color + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1641593525 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1641593522} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1673476642 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1673476643} + - component: {fileID: 1673476645} + - component: {fileID: 1673476644} + m_Layer: 0 + m_Name: WaterSprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1673476643 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1673476642} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.48, y: 1.48, z: 1.48} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 242385329} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1673476644 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1673476642} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1673476645 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1673476642} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2105693144} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: bd3249e8aae01e748aaca0c062e2c19c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1675838107 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1675838108} + - component: {fileID: 1675838112} + - component: {fileID: 1675838111} + m_Layer: 0 + m_Name: Army + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1675838108 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 60, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 608638373} + - {fileID: 489557969} + m_Father: {fileID: 1563905016} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1675838111 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1675838112 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1399293758} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1675907430 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1675907431} + - component: {fileID: 1675907433} + - component: {fileID: 1675907432} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1675907431 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675907430} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 766050008} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1675907432 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675907430} + m_Text: Gradient Scroll + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1675907433 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675907430} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1687594935 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1687594936} + - component: {fileID: 1687594940} + - component: {fileID: 1687594939} + - component: {fileID: 1687594937} + m_Layer: 0 + m_Name: Alpha Cutoff + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1687594936 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1687594935} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 310, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1510314498} + - {fileID: 2088187658} + m_Father: {fileID: 2036092933} + m_RootOrder: 31 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1687594937 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1687594935} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: d7d72c9f17b0ebe4e908dab552b82c45, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &1687594939 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1687594935} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1687594940 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1687594935} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 70619476} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1688633193 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1688633194} + - component: {fileID: 1688633196} + - component: {fileID: 1688633195} + m_Layer: 0 + m_Name: Sprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1688633194 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1688633193} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.3336719, y: 1.333672, z: 1.3336719} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 166039413} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1688633195 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1688633193} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1688633196 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1688633193} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1213636577} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: bd3249e8aae01e748aaca0c062e2c19c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1693197524 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CONTRAST_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: -0.01 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 6 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1697295736 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1697295737} + - component: {fileID: 1697295739} + - component: {fileID: 1697295738} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1697295737 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697295736} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1211354477} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1697295738 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697295736} + m_Text: HP Bar + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1697295739 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697295736} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1697898090 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1697898091} + - component: {fileID: 1697898093} + - component: {fileID: 1697898092} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1697898091 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697898090} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1119325822} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1697898092 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697898090} + m_Text: Twist + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1697898093 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697898090} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1706778796 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1706778797} + - component: {fileID: 1706778799} + - component: {fileID: 1706778798} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1706778797 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1706778796} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1613686741} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1706778798 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1706778796} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1706778799 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1706778796} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &1708657337 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - ALPHACUTOFF_ON + - PIXELATE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.458 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1724918723 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1724918724} + - component: {fileID: 1724918727} + - component: {fileID: 1724918726} + - component: {fileID: 1724918725} + m_Layer: 0 + m_Name: Sprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1724918724 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1724918723} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 80, y: 80, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1923390774} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1724918725 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1724918723} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1724918726 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1724918723} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1724918727 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1724918723} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 465147594} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 839adabbc5de26041bac66450214a831, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1727216259 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1727216260} + - component: {fileID: 1727216262} + - component: {fileID: 1727216261} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1727216260 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1727216259} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 450696184} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1727216261 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1727216259} + m_Text: Procedural Soldier + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1727216262 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1727216259} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1728754560 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1728754561} + - component: {fileID: 1728754563} + - component: {fileID: 1728754562} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1728754561 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1728754560} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1728754562 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1728754560} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1728754563 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1728754560} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1734593091 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1734593092} + - component: {fileID: 1734593093} + m_Layer: 0 + m_Name: Burn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1734593092 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1734593091} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.0582, y: 0.0425, z: -0.1} + m_LocalScale: {x: 0.67673415, y: 0.7130322, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1861014113} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1734593093 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1734593091} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a186aad8f5f9dd04d910c7e3174834c0, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: be304275dbf36014ca9828884588ac47, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 1 + m_SpriteSortPoint: 0 +--- !u!21 &1735095770 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 0 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1749643254 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1749643255} + - component: {fileID: 1749643257} + - component: {fileID: 1749643256} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1749643255 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1749643254} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1953432852} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1749643256 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1749643254} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1749643257 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1749643254} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1755864201 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1755864202} + - component: {fileID: 1755864204} + - component: {fileID: 1755864203} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1755864202 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1755864201} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1883979700} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1755864203 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1755864201} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1755864204 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1755864201} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1756331348 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1756331349} + - component: {fileID: 1756331353} + - component: {fileID: 1756331352} + m_Layer: 0 + m_Name: Portal + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1756331349 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1756331348} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 140, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1858630623} + - {fileID: 550220621} + - {fileID: 409423831} + m_Father: {fileID: 1563905016} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1756331352 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1756331348} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1756331353 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1756331348} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1195370958} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 1 + m_SpriteSortPoint: 0 +--- !u!1 &1767383823 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1767383824} + - component: {fileID: 1767383826} + - component: {fileID: 1767383827} + - component: {fileID: 1767383828} + m_Layer: 0 + m_Name: Blur + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1767383824 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767383823} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 200, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 878272797} + - {fileID: 1328027728} + m_Father: {fileID: 2036092933} + m_RootOrder: 20 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1767383826 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767383823} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 85408337} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1767383827 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767383823} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!95 &1767383828 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767383823} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 4d13c3a68decb714e80835bb34f348f3, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!21 &1769422912 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - WARP_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 1.5 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.51 + - _WarpSpeed: 10.9 + - _WarpStrength: 0.0211 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1774397170 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - BLUR_ON + - DISTORT_ON + - FADE_ON + - HITEFFECT_ON + - OUTBASE8DIR_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 100 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.93 + - _DistortTexXSpeed: -1 + - _DistortTexYSpeed: -11.6 + - _EditorDrawers: 6 + - _FadeAmount: 0.29 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 6.8 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 193 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.091 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 1, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 0, g: 1, b: 0.979686, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1774554235 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GRADIENT_ON + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0.8407619, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0.83921576, b: 1, a: 1} + - _GradTopLeftCol: {r: 0, g: 0.13740095, b: 0.4627451, a: 1} + - _GradTopRightCol: {r: 0, g: 0.14242734, b: 0.46226418, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1778749803 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1778749804} + - component: {fileID: 1778749807} + - component: {fileID: 1778749806} + m_Layer: 0 + m_Name: Hand Drawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1778749804 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778749803} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 644371592} + - {fileID: 1601051770} + m_Father: {fileID: 1351315063} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1778749806 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778749803} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1778749807 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778749803} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 469847421} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1797106725 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1797106726} + - component: {fileID: 1797106728} + - component: {fileID: 1797106727} + m_Layer: 0 + m_Name: FireBack + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1797106726 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1797106725} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.7405772, y: 0.7405772, z: 0.7405772} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1953432852} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1797106727 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1797106725} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1797106728 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1797106725} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1201459352} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: bd6f48b4407043345b1a3a07df8c4d61, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1809913716 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1809913717} + - component: {fileID: 1809913719} + - component: {fileID: 1809913718} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1809913717 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1809913716} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2035943844} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1809913718 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1809913716} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1809913719 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1809913716} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1813870143 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1813870144} + - component: {fileID: 1813870146} + - component: {fileID: 1813870147} + m_Layer: 0 + m_Name: Chromatic Aberration + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1813870144 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1813870143} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 240, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 858113522} + - {fileID: 376742882} + m_Father: {fileID: 2036092933} + m_RootOrder: 24 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1813870146 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1813870143} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1377307553} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1813870147 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1813870143} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1814697822 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - BLUR_ON + - COLORRAMP_ON + - GLOWTEX_ON + - GLOW_ON + - HOLOGRAM_ON + - HSV_ON + - PINCH_ON + - ROTATEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 763e13699209a614b8800c76fc9dee48, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 81687001a52d8024fb3706ba7619ad4b, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 5.1 + - _Brightness: 0 + - _ChromAberrAlpha: 0.461 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: -0.21 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 7.4 + - _GlitchSize: 2.57 + - _GlitchSpeed: 20 + - _Glow: 3.9 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0.651 + - _HologramStripesAmount: 0.124 + - _HologramStripesSpeed: 2.8 + - _HologramUnmodAmount: 0 + - _HsvBright: 1.07 + - _HsvSaturation: 1.86 + - _HsvShift: 360 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 6.28 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1818617669 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1818617670} + - component: {fileID: 1818617672} + - component: {fileID: 1818617671} + m_Layer: 0 + m_Name: Outline1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1818617670 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818617669} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -1.5, y: 0.82, z: 0.05} + m_LocalScale: {x: 1.0080961, y: 1.0080961, z: 1.0080961} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1818617671 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818617669} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 0 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1818617672 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818617669} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 2fff2435ee99439438c463e2ce768283, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 1 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1820263336 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CLIPPING_ON + - WAVEUV_ON + - WIND_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0.35 + - _ClipUvRight: 0.35 + - _ClipUvUp: 0.06 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.02 + - _GrassSpeed: 2 + - _GrassWind: 2 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 5.67 + - _WaveSpeed: 2 + - _WaveStrength: 2.32 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1822267180 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1822267181} + - component: {fileID: 1822267183} + - component: {fileID: 1822267182} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1822267181 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1822267180} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1447921189} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1822267182 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1822267180} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1822267183 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1822267180} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1828174012 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1828174013} + - component: {fileID: 1828174015} + - component: {fileID: 1828174014} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1828174013 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1828174012} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2082220742} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1828174014 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1828174012} + m_Text: Rotate + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1828174015 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1828174012} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1843941479 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1843941480} + - component: {fileID: 1843941482} + - component: {fileID: 1843941481} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1843941480 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1843941479} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 540549269} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1843941481 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1843941479} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1843941482 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1843941479} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1848773094 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1848773095} + - component: {fileID: 1848773097} + - component: {fileID: 1848773096} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1848773095 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1848773094} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1478122371} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1848773096 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1848773094} + m_Text: Outline Always Visible + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1848773097 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1848773094} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1850969166 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1850969167} + - component: {fileID: 1850969169} + - component: {fileID: 1850969168} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1850969167 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1850969166} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1073973762} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1850969168 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1850969166} + m_Text: Distorted Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1850969169 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1850969166} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1858630622 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1858630623} + - component: {fileID: 1858630625} + - component: {fileID: 1858630624} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1858630623 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858630622} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1756331349} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1858630624 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858630622} + m_Text: Portal + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1858630625 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858630622} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1861014112 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1861014113} + - component: {fileID: 1861014117} + - component: {fileID: 1861014116} + - component: {fileID: 1861014114} + - component: {fileID: 1861014118} + m_Layer: 0 + m_Name: BurningSoldier + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1861014113 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1861014112} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 340, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1734593092} + - {fileID: 1523182285} + - {fileID: 945953421} + m_Father: {fileID: 1563905016} + m_RootOrder: 34 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!331 &1861014114 +SpriteMask: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1861014112} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10758, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_MaskAlphaCutoff: 0.2 + m_FrontSortingLayerID: 0 + m_BackSortingLayerID: 0 + m_FrontSortingLayer: 0 + m_BackSortingLayer: 0 + m_FrontSortingOrder: 0 + m_BackSortingOrder: 0 + m_IsCustomRangeActive: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1861014116 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1861014112} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1861014117 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1861014112} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: cd0693e274874cc4f8ffd67a41ebe801, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &1861014118 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1861014112} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 5f3b82f530c24dd48961a1d428ed91d8, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!21 &1863638619 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - PINCH_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0.097 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.1 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1868383713 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1868383714} + - component: {fileID: 1868383716} + - component: {fileID: 1868383715} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1868383714 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1868383713} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1988936578} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1868383715 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1868383713} + m_Text: Color Ramp + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1868383716 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1868383713} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1869989729 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1869989730} + - component: {fileID: 1869989732} + - component: {fileID: 1869989731} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1869989730 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1869989729} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 357954209} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1869989731 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1869989729} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1869989732 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1869989729} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1875180450 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1875180451} + - component: {fileID: 1875180455} + - component: {fileID: 1875180454} + - component: {fileID: 1875180452} + m_Layer: 0 + m_Name: Teleport + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1875180451 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 40, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 520963778} + - {fileID: 152938704} + m_Father: {fileID: 1563905016} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1875180452 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 2cd3280111dab4e41ba2dd630db17ca4, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &1875180454 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1875180455 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 195375977} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1880243539 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1880243540} + - component: {fileID: 1880243542} + - component: {fileID: 1880243541} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1880243540 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880243539} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 586081879} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1880243541 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880243539} + m_Text: Greyscale + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1880243542 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880243539} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1881847163 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1881847164} + - component: {fileID: 1881847166} + - component: {fileID: 1881847165} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1881847164 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1881847163} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1528149039} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1881847165 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1881847163} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1881847166 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1881847163} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1883979699 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1883979700} + - component: {fileID: 1883979702} + m_Layer: 0 + m_Name: Flag + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1883979700 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1883979699} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 190, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1097188550} + - {fileID: 1755864202} + - {fileID: 935289136} + m_Father: {fileID: 1563905016} + m_RootOrder: 19 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1883979702 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1883979699} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1884970176 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1884970177} + - component: {fileID: 1884970179} + - component: {fileID: 1884970178} + m_Layer: 0 + m_Name: SnowFlakesPS + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1884970177 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1884970176} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.02, z: -0.2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 511167261} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} +--- !u!199 &1884970178 +ParticleSystemRenderer: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1884970176} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: aae53a69b285d6f4aad0e6953245bc7d, type: 2} + - {fileID: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_RenderMode: 0 + m_MeshDistribution: 0 + m_SortMode: 0 + m_MinParticleSize: 0 + m_MaxParticleSize: 0.5 + m_CameraVelocityScale: 0 + m_VelocityScale: 0 + m_LengthScale: 2 + m_SortingFudge: 0 + m_NormalDirection: 1 + m_ShadowBias: 0 + m_RenderAlignment: 0 + m_Pivot: {x: 0, y: 0, z: 0} + m_Flip: {x: 0, y: 0, z: 0} + m_UseCustomVertexStreams: 0 + m_EnableGPUInstancing: 1 + m_ApplyActiveColorSpace: 1 + m_AllowRoll: 1 + m_FreeformStretching: 0 + m_RotateWithStretchDirection: 1 + m_VertexStreams: 00010304 + m_Mesh: {fileID: 0} + m_Mesh1: {fileID: 0} + m_Mesh2: {fileID: 0} + m_Mesh3: {fileID: 0} + m_MeshWeighting: 1 + m_MeshWeighting1: 1 + m_MeshWeighting2: 1 + m_MeshWeighting3: 1 + m_MaskInteraction: 0 +--- !u!198 &1884970179 +ParticleSystem: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1884970176} + serializedVersion: 8 + lengthInSec: 1 + simulationSpeed: 1 + stopAction: 0 + cullingMode: 0 + ringBufferMode: 0 + ringBufferLoopRange: {x: 0, y: 1} + emitterVelocityMode: 0 + looping: 1 + prewarm: 0 + playOnAwake: 1 + useUnscaledTime: 0 + autoRandomSeed: 1 + startDelay: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.05 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + moveWithTransform: 0 + moveWithCustomTransform: {fileID: 0} + scalingMode: 1 + randomSeed: 0 + InitialModule: + serializedVersion: 3 + enabled: 1 + startLifetime: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 5 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSpeed: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startColor: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + startSize: + serializedVersion: 2 + minMaxState: 3 + scalar: 0.75 + minScalar: 0.2 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSizeY: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSizeZ: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotationX: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotationY: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotation: + serializedVersion: 2 + minMaxState: 3 + scalar: 6.283185 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + randomizeRotationDirection: 0 + maxNumParticles: 1000 + customEmitterVelocity: {x: 0, y: 0, z: 0} + size3D: 0 + rotation3D: 0 + gravityModifier: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + ShapeModule: + serializedVersion: 6 + enabled: 1 + type: 10 + angle: 25 + length: 5 + boxThickness: {x: 0, y: 0, z: 0} + radiusThickness: 1 + donutRadius: 0.2 + m_Position: {x: 0, y: 0, z: 0} + m_Rotation: {x: 0, y: 0, z: 0} + m_Scale: {x: 1, y: 1, z: 1} + placementMode: 0 + m_MeshMaterialIndex: 0 + m_MeshNormalOffset: 0 + m_MeshSpawn: + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Mesh: {fileID: 0} + m_MeshRenderer: {fileID: 0} + m_SkinnedMeshRenderer: {fileID: 0} + m_Sprite: {fileID: 0} + m_SpriteRenderer: {fileID: 0} + m_UseMeshMaterialIndex: 0 + m_UseMeshColors: 1 + alignToDirection: 0 + m_Texture: {fileID: 0} + m_TextureClipChannel: 3 + m_TextureClipThreshold: 0 + m_TextureUVChannel: 0 + m_TextureColorAffectsParticles: 1 + m_TextureAlphaAffectsParticles: 1 + m_TextureBilinearFiltering: 0 + randomDirectionAmount: 0 + sphericalDirectionAmount: 0 + randomPositionAmount: 0 + radius: + value: 1.5 + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + arc: + value: 360 + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + EmissionModule: + enabled: 1 + serializedVersion: 4 + rateOverTime: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 10 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + rateOverDistance: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BurstCount: 1 + m_Bursts: + - serializedVersion: 2 + time: 0 + countCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 15 + minScalar: 30 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + cycleCount: 1 + repeatInterval: 0.01 + probability: 1 + SizeModule: + enabled: 1 + curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 15.478566 + outSlope: 15.478566 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.061415076 + value: 0.9506173 + inSlope: 0.28985757 + outSlope: 0.28985757 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.24300326 + - serializedVersion: 3 + time: 0.6683 + value: 0.8456783 + inSlope: -1.3612208 + outSlope: -1.3612208 + tangentMode: 34 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: -2.5495274 + outSlope: -2.5495274 + tangentMode: 34 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + RotationModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.7853982 + minScalar: 0.7853982 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + ColorModule: + enabled: 1 + gradient: + serializedVersion: 2 + minMaxState: 1 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 23708 + atime2: 65535 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 3 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + UVModule: + serializedVersion: 2 + enabled: 0 + mode: 0 + timeMode: 0 + fps: 30 + frameOverTime: + serializedVersion: 2 + minMaxState: 1 + scalar: 0.9999 + minScalar: 0.9999 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startFrame: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + speedRange: {x: 0, y: 1} + tilesX: 1 + tilesY: 1 + animationType: 0 + rowIndex: 0 + cycles: 1 + uvChannelMask: -1 + rowMode: 1 + sprites: + - sprite: {fileID: 0} + flipU: 0 + flipV: 0 + VelocityModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalX: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalY: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetX: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetY: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + radial: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + speedModifier: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + inWorldSpace: 0 + InheritVelocityModule: + enabled: 0 + m_Mode: 0 + m_Curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + LifetimeByEmitterSpeedModule: + enabled: 0 + m_Curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: -0.8 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0.2 + inSlope: -0.8 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Range: {x: 0, y: 1} + ForceModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + inWorldSpace: 0 + randomizePerFrame: 0 + ExternalForcesModule: + serializedVersion: 2 + enabled: 0 + multiplierCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + influenceFilter: 0 + influenceMask: + serializedVersion: 2 + m_Bits: 4294967295 + influenceList: [] + ClampVelocityModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + magnitude: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxis: 0 + inWorldSpace: 0 + multiplyDragByParticleSize: 1 + multiplyDragByParticleVelocity: 1 + dampen: 0 + drag: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + NoiseModule: + enabled: 0 + strength: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + strengthY: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + strengthZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + frequency: 0.5 + damping: 1 + octaves: 1 + octaveMultiplier: 0.5 + octaveScale: 2 + quality: 2 + scrollSpeed: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remap: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapY: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapZ: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapEnabled: 0 + positionAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + rotationAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + sizeAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + SizeBySpeedModule: + enabled: 0 + curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + range: {x: 0, y: 1} + separateAxes: 0 + RotationBySpeedModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.7853982 + minScalar: 0.7853982 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + range: {x: 0, y: 1} + ColorBySpeedModule: + enabled: 0 + gradient: + serializedVersion: 2 + minMaxState: 1 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + range: {x: 0, y: 1} + CollisionModule: + enabled: 0 + serializedVersion: 4 + type: 0 + collisionMode: 0 + colliderForce: 0 + multiplyColliderForceByParticleSize: 0 + multiplyColliderForceByParticleSpeed: 0 + multiplyColliderForceByCollisionAngle: 1 + m_Planes: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_Dampen: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Bounce: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_EnergyLossOnCollision: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minKillSpeed: 0 + maxKillSpeed: 10000 + radiusScale: 1 + collidesWith: + serializedVersion: 2 + m_Bits: 4294967295 + maxCollisionShapes: 256 + quality: 0 + voxelSize: 0.5 + collisionMessages: 0 + collidesWithDynamic: 1 + interiorCollisions: 0 + TriggerModule: + enabled: 0 + serializedVersion: 2 + inside: 1 + outside: 0 + enter: 0 + exit: 0 + colliderQueryMode: 0 + radiusScale: 1 + primitives: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + SubModule: + serializedVersion: 2 + enabled: 0 + subEmitters: + - serializedVersion: 3 + emitter: {fileID: 0} + type: 0 + properties: 0 + emitProbability: 1 + LightsModule: + enabled: 0 + ratio: 0 + light: {fileID: 0} + randomDistribution: 1 + color: 1 + range: 1 + intensity: 1 + rangeCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + intensityCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + maxLights: 20 + TrailModule: + enabled: 0 + mode: 0 + ratio: 1 + lifetime: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minVertexDistance: 0.2 + textureMode: 0 + ribbonCount: 1 + shadowBias: 0.5 + worldSpace: 0 + dieWithParticles: 1 + sizeAffectsWidth: 1 + sizeAffectsLifetime: 0 + inheritParticleColor: 1 + generateLightingData: 0 + splitSubEmitterRibbons: 0 + attachRibbonsToTransform: 0 + colorOverLifetime: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + widthOverTrail: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorOverTrail: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + CustomDataModule: + enabled: 0 + mode0: 0 + vectorComponentCount0: 4 + color0: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + colorLabel0: Color + vector0_0: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_0: X + vector0_1: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_1: Y + vector0_2: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_2: Z + vector0_3: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_3: W + mode1: 0 + vectorComponentCount1: 4 + color1: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + colorLabel1: Color + vector1_0: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_0: X + vector1_1: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_1: Y + vector1_2: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_2: Z + vector1_3: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_3: W +--- !u!1 &1888002956 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1888002957} + - component: {fileID: 1888002959} + - component: {fileID: 1888002958} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1888002957 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1888002956} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1934762264} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1888002958 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1888002956} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1888002959 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1888002956} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!4 &1893925001 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + m_PrefabInstance: {fileID: 3864259598862589320} + m_PrefabAsset: {fileID: 0} +--- !u!1 &1901854649 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1901854650} + - component: {fileID: 1901854654} + - component: {fileID: 1901854653} + - component: {fileID: 1901854651} + m_Layer: 0 + m_Name: Offset + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1901854650 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901854649} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 50, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 164406719} + - {fileID: 1562540217} + m_Father: {fileID: 1351315063} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1901854651 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901854649} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 63273b05c4774384b85a146feb6df4d3, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &1901854653 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901854649} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1901854654 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901854649} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1605957010} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1912112097 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CLIPPING_ON + - GLOW_ON + - HSV_ON + - PINCH_ON + - ROTATEUV_ON + - TWISTUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0.05 + - _ClipUvLeft: 0.05 + - _ClipUvRight: 0.05 + - _ClipUvUp: 0.05 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 0 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 0 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.62 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1916465495 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1916465496} + - component: {fileID: 1916465499} + - component: {fileID: 1916465498} + - component: {fileID: 1916465497} + m_Layer: 0 + m_Name: BlurredOutline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1916465496 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1916465495} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.05} + m_LocalScale: {x: 1.009596, y: 1.009596, z: 1.009596} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 499272004} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1916465497 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1916465495} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1916465498 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1916465495} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1916465499 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1916465495} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 430987701} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1923390773 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1923390774} + - component: {fileID: 1923390776} + m_Layer: 0 + m_Name: RadialGradient + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1923390774 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1923390773} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 90, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1724918724} + - {fileID: 1450664986} + - {fileID: 556503704} + m_Father: {fileID: 2036092933} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1923390776 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1923390773} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1924503771 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1924503772} + - component: {fileID: 1924503774} + - component: {fileID: 1924503773} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1924503772 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1924503771} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1415143267} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1924503773 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1924503771} + m_Text: Unified Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1924503774 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1924503771} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1931308734 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1931308735} + - component: {fileID: 1931308737} + - component: {fileID: 1931308738} + m_Layer: 0 + m_Name: Color Swap + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1931308735 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 100, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 443722314} + - {fileID: 427761889} + m_Father: {fileID: 2036092933} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1931308737 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 108846146} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1931308738 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1934762263 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1934762264} + - component: {fileID: 1934762267} + - component: {fileID: 1934762266} + - component: {fileID: 1934762268} + m_Layer: 0 + m_Name: Burn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1934762264 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 396641006} + - {fileID: 1888002957} + m_Father: {fileID: 1563905016} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1934762266 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1934762267 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 639189023} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &1934762268 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 9d3bba413d0ce9244b743d634f8d3c27, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!21 &1936528753 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - OVERLAY_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 0.413 + - _OverlayGlow: 1.8 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1937897984 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1937897985} + - component: {fileID: 1937897987} + - component: {fileID: 1937897986} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1937897985 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1937897984} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2035943844} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1937897986 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1937897984} + m_Text: Blurred Back + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1937897987 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1937897984} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1939042050 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1939042051} + - component: {fileID: 1939042053} + - component: {fileID: 1939042052} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1939042051 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1939042050} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 443772011} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1939042052 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1939042050} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1939042053 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1939042050} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1939573376 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1939573377} + - component: {fileID: 1939573379} + - component: {fileID: 1939573378} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1939573377 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1939573376} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1507269762} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &1939573378 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1939573376} + m_Text: Twist Disappear + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &1939573379 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1939573376} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1949787729 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1949787730} + - component: {fileID: 1949787731} + m_Layer: 0 + m_Name: BackFrame + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1949787730 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1949787729} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.05} + m_LocalScale: {x: 95.922, y: 95.922, z: 95.922} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 242385329} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1949787731 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1949787729} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 839adabbc5de26041bac66450214a831, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.04, y: 0.04} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1953432851 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1953432852} + - component: {fileID: 1953432853} + m_Layer: 0 + m_Name: Fire + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1953432852 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1953432851} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 170, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1797106726} + - {fileID: 682244417} + - {fileID: 1091797526} + - {fileID: 1749643255} + m_Father: {fileID: 1563905016} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1953432853 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1953432851} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1956560312 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLOW_ON + - GRADIENT_ON + - RADIALGRADIENT_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GRADISRADIAL_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 0.741 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 5.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.3 + - _GradBoostY: 1.2 + - _GradIsRadial: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0.9686275, g: 0.03137255, b: 0.03137255, a: 0} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1984207367 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - OUTBASE8DIR_ON + - WAVEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0159 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 8.95 + - _WaveSpeed: 12.14 + - _WaveStrength: 18.77 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1986728941 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1986728942} + - component: {fileID: 1986728946} + - component: {fileID: 1986728945} + - component: {fileID: 1986728943} + m_Layer: 0 + m_Name: Zoom + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1986728942 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1986728941} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 90, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 499438417} + - {fileID: 1090919393} + m_Father: {fileID: 1351315063} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &1986728943 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1986728941} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: f63147b3bd9ae6949be2ad05c6679dd5, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &1986728945 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1986728941} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1986728946 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1986728941} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 984421900} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1988936577 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1988936578} + - component: {fileID: 1988936580} + - component: {fileID: 1988936581} + m_Layer: 0 + m_Name: Color Ramp + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1988936578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 130, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1868383714} + - {fileID: 1146988138} + m_Father: {fileID: 2036092933} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1988936580 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 581202604} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1988936581 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2004669563 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2004669564} + - component: {fileID: 2004669566} + - component: {fileID: 2004669565} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &2004669564 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2004669563} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 252177636} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2004669565 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2004669563} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2004669566 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2004669563} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &2007448611 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - HSV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1.86 + - _HsvShift: 322 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &2008035788 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2008035789} + - component: {fileID: 2008035791} + - component: {fileID: 2008035790} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2008035789 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2008035788} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 357954209} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2008035790 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2008035788} + m_Text: Twisted Face + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2008035791 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2008035788} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &2018750311 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2018750312} + - component: {fileID: 2018750314} + - component: {fileID: 2018750313} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2018750312 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2018750311} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2045252512} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2018750313 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2018750311} + m_Text: Hologram + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2018750314 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2018750311} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &2023359957 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2023359958} + - component: {fileID: 2023359960} + - component: {fileID: 2023359959} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2023359958 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2023359957} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 939106332} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2023359959 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2023359957} + m_Text: Motion Blur + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2023359960 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2023359957} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &2023436102 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORSWAP_ON + - GLOWTEX_ON + - GLOW_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 3d311990b7c2c59478bacea537a60a53, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.163 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 4.1 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1.66 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 0.6144985, b: 0, a: 1} + - _ColorSwapGreen: {r: 0, g: 0.57254905, b: 1.7176471, a: 1} + - _ColorSwapRed: {r: 1, g: 0.9806782, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.59364164, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &2035943843 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2035943844} + - component: {fileID: 2035943847} + - component: {fileID: 2035943846} + m_Layer: 0 + m_Name: Blurred Back + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2035943844 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2035943843} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 130, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1937897985} + - {fileID: 1809913717} + - {fileID: 1113550345} + m_Father: {fileID: 1563905016} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2035943846 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2035943843} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &2035943847 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2035943843} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 727703726} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 758ac31a9bff9ac4181f54de54a6ecb7, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 12.8, y: 6.4} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &2036092932 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2036092933} + - component: {fileID: 2036092934} + - component: {fileID: 2036092935} + m_Layer: 0 + m_Name: 1.Color Effects + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2036092933 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2036092932} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 4825911116503289154} + - {fileID: 1120052622} + - {fileID: 1613686741} + - {fileID: 290590332} + - {fileID: 419407226} + - {fileID: 1073973762} + - {fileID: 312669278} + - {fileID: 471382084} + - {fileID: 984096428} + - {fileID: 1923390774} + - {fileID: 1931308735} + - {fileID: 1229041066} + - {fileID: 1313138820} + - {fileID: 1988936578} + - {fileID: 597182738} + - {fileID: 746759203} + - {fileID: 1434614528} + - {fileID: 1028271463} + - {fileID: 586081879} + - {fileID: 944684573} + - {fileID: 1767383824} + - {fileID: 939106332} + - {fileID: 368348656} + - {fileID: 1286689243} + - {fileID: 1813870144} + - {fileID: 485976056} + - {fileID: 1447921189} + - {fileID: 420059981} + - {fileID: 548255500} + - {fileID: 1073566156} + - {fileID: 1123731223} + - {fileID: 1687594936} + m_Father: {fileID: 732186310} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2036092934 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2036092932} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6972382efdee4c642812251660f0c4bb, type: 3} + m_Name: + m_EditorClassIdentifier: + radius: 40 + rotateSpeed: 10 +--- !u!114 &2036092935 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2036092932} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 681095680e77fad40a6dd907b8ba358b, type: 3} + m_Name: + m_EditorClassIdentifier: + paddingX: 10 +--- !u!1 &2045252511 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2045252512} + - component: {fileID: 2045252515} + - component: {fileID: 2045252514} + - component: {fileID: 2045252516} + m_Layer: 0 + m_Name: Hologram + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2045252512 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2018750312} + - {fileID: 1194409627} + m_Father: {fileID: 1563905016} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2045252514 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &2045252515 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1363957141} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!95 &2045252516 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: ad5ae64e9a03a1a40889385b2d0f2b89, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!21 &2054684528 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLOW_ON + - HSV_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - OUTTEX_ON + - POLARUV_ON + - TEXTURESCROLL_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + - _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 3, y: 3} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 1.2 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0.465 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 0 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0204 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 1.13 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &2061184730 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - HSV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1.03 + - _HsvSaturation: 1.262 + - _HsvShift: 251 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &2064997617 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2064997618} + - component: {fileID: 2064997620} + - component: {fileID: 2064997619} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2064997618 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2064997617} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 499272004} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2064997619 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2064997617} + m_Text: Blurred Outline + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2064997620 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2064997617} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &2065278699 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2065278700} + - component: {fileID: 2065278702} + - component: {fileID: 2065278701} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &2065278700 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2065278699} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1229041066} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2065278701 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2065278699} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2065278702 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2065278699} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &2066467196 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORSWAP_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.2 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.02 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 0, b: 0, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &2067098021 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CLIPPING_ON + - GRADIENT_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 1 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0.023718417, g: 0.38679248, b: 0.023718417, a: 1} + - _GradBotRightCol: {r: 0.019607844, g: 0.34117648, b: 0.019607844, a: 1} + - _GradTopLeftCol: {r: 0.16907978, g: 1, b: 0, a: 1} + - _GradTopRightCol: {r: 0.16862746, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &2076240280 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - ALPHAOUTLINE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 33.7 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 0.96902657, g: 1, b: 0, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &2076635523 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2076635524} + - component: {fileID: 2076635526} + - component: {fileID: 2076635525} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2076635524 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2076635523} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 361311995} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2076635525 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2076635523} + m_Text: Wind + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2076635526 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2076635523} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &2082220741 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2082220742} + - component: {fileID: 2082220746} + - component: {fileID: 2082220745} + - component: {fileID: 2082220743} + m_Layer: 0 + m_Name: Rotate + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2082220742 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2082220741} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 130, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1828174013} + - {fileID: 337231025} + m_Father: {fileID: 1351315063} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &2082220743 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2082220741} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 1243dd8a666ff6b4787a02084a5170d1, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &2082220745 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2082220741} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &2082220746 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2082220741} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 139334897} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &2088187657 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2088187658} + - component: {fileID: 2088187660} + - component: {fileID: 2088187659} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2088187658 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2088187657} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1687594936} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2088187659 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2088187657} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2088187660 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2088187657} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &2096881074 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2096881075} + - component: {fileID: 2096881080} + - component: {fileID: 2096881079} + - component: {fileID: 2096881076} + m_Layer: 0 + m_Name: ShinyMarine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2096881075 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2096881074} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 280, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1103527058} + - {fileID: 242658910} + m_Father: {fileID: 1563905016} + m_RootOrder: 28 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &2096881076 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2096881074} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 8652a2e9bd26fdf45b91d4e790b17cb1, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!212 &2096881079 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2096881074} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1283967498} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &2096881080 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2096881074} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2099543391 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2099543392} + - component: {fileID: 2099543394} + - component: {fileID: 2099543393} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &2099543392 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2099543391} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 42135250} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2099543393 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2099543391} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2099543394 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2099543391} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &2105693144 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - DISTORT_ON + - HSV_ON + - TEXTURESCROLL_ON + - WAVEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.25 + - _DistortTexXSpeed: 3 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1.24 + - _HsvSaturation: 1.68 + - _HsvShift: 313 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: -0.25 + - _TextureScrollYSpeed: 0.05 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 13.5 + - _WaveSpeed: 12.7 + - _WaveStrength: 13.4 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &2117073027 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2117073028} + - component: {fileID: 2117073030} + - component: {fileID: 2117073029} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &2117073028 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2117073027} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 595151377} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!102 &2117073029 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2117073027} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!23 &2117073030 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2117073027} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!21 &2128149943 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - HSV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 0.74 + - _HsvSaturation: 1.5 + - _HsvShift: 81 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &2134460148 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2134460149} + - component: {fileID: 2134460151} + - component: {fileID: 2134460150} + m_Layer: 0 + m_Name: Outline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2134460149 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2134460148} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0.05} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1478122371} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2134460150 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2134460148} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 0 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &2134460151 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2134460148} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 453643567} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &2136425119 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - SHINE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 2.15, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.25 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 0 + - _RadialClip2: 45 + - _RadialClipAngle: 90 + - _RadialClipArc1: 45 + - _RadialClipArc2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 0.8 + - _ShineLocation: 0.49 + - _ShineRotate: 0 + - _ShineWidth: 0.119 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1001 &3864259598862589320 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1563905016} + m_Modifications: + - target: {fileID: 3864259599213150332, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_Materials.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641152, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_Name + value: Shield Soldier Demo + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_RootOrder + value: 36 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalPosition.x + value: 360 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3864259599682641153, guid: 11bf72cfca6ba93459ddeacea51fd0bd, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 11bf72cfca6ba93459ddeacea51fd0bd, type: 3} +--- !u!4 &4005302481246734412 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + m_PrefabInstance: {fileID: 6452353472261279598} + m_PrefabAsset: {fileID: 0} +--- !u!4 &4825911116503289154 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 55667222} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1571920279} + - {fileID: 1356966097} + m_Father: {fileID: 2036092933} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &5952972451371321216 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5952972451371321217} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 384dba07353e1f242b467b6857a1e3d4, type: 3} + m_Name: + m_EditorClassIdentifier: + numericPropertyName: _HsvShift + scrollSpeed: 0.1 + applyModulo: 1 + modulo: 360 + mat: {fileID: 0} +--- !u!1 &5952972451371321217 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5952972451371321220} + - component: {fileID: 5952972451371321221} + - component: {fileID: 5952972451371321218} + - component: {fileID: 5952972451371321219} + - component: {fileID: 5952972451371321216} + m_Layer: 0 + m_Name: Pattern + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &5952972451371321218 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5952972451371321217} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!95 &5952972451371321219 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5952972451371321217} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: f994ff75b3f33ae46af22e6462b4606a, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!4 &5952972451371321220 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5952972451371321217} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 595151377} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &5952972451371321221 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5952972451371321217} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1814697822} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 2f5c9cbfde2d0384bb53189b0d0f06d8, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 2 + m_Size: {x: 5, y: 5} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1001 &6452353472261279598 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1563905016} + m_Modifications: + - target: {fileID: 7935039278937507617, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_Name + value: Particle System Demo + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_RootOrder + value: 22 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalPosition.x + value: 220 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7935039278937507618, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7935039279205550812, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_Materials.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7935039279205550812, guid: 161eac4f3ec2ef344ae473e275658ecf, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 540543599} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 161eac4f3ec2ef344ae473e275658ecf, type: 3} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity.meta new file mode 100644 index 00000000..624e4c5e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: aa7236836849adb4285d82814f472ea5 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Demo.unity + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity new file mode 100644 index 00000000..38017ff6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity @@ -0,0 +1,10963 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 512 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 1 + m_PVRFilteringGaussRadiusAO: 1 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 4890085278179872738, guid: 94d47ab548a5c4047bba8f9cd124338c, + type: 2} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &22377052 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 22377056} + - component: {fileID: 22377055} + - component: {fileID: 22377054} + - component: {fileID: 22377053} + m_Layer: 0 + m_Name: Pinch + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &22377053 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 22377052} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &22377054 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 22377052} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &22377055 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 22377052} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 429931735} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &22377056 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 22377052} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -15.4, y: -5.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &56751282 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 56751283} + - component: {fileID: 56751286} + - component: {fileID: 56751285} + - component: {fileID: 56751284} + m_Layer: 0 + m_Name: Watery + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &56751283 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -19.67, y: -5.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &56751284 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &56751285 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &56751286 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 56751282} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1455058978} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &173818797 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLOWTEX_ON + - GLOW_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - TWISTUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0.95 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 0.95 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 17.1 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 14 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.028 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.251 + - _PixelateSize: 60 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1.41 + - _TwistUvPosX: 0.558 + - _TwistUvPosY: 0.503 + - _TwistUvRadius: 0.2 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.7877358, b: 0.7877358, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &252177635 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 252177636} + - component: {fileID: 252177639} + - component: {fileID: 252177638} + - component: {fileID: 252177637} + m_Layer: 0 + m_Name: Gameboy + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &252177636 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -15.49, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &252177637 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &252177638 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &252177639 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 252177635} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1807806170} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &290590332 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 4.5100007, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &290590333 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 290590332} + - component: {fileID: 290590335} + - component: {fileID: 290590336} + - component: {fileID: 290590334} + m_Layer: 0 + m_Name: Outline1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &290590334 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &290590335 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1847541096} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &290590336 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 290590333} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &298946310 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 298946312} + - component: {fileID: 298946311} + m_Layer: 0 + m_Name: AutoScroll + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &298946311 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298946310} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cc188be2d64e8d041aed6f375d92c463, type: 3} + m_Name: + m_EditorClassIdentifier: + totalTime: 12 + sceneDescription: {fileID: 2008890716} +--- !u!4 &298946312 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 298946310} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 2.7768, y: 2.7768, z: 2.7768} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 252177636} + - {fileID: 786925991} + - {fileID: 984096428} + - {fileID: 520228356} + - {fileID: 1119325822} + - {fileID: 22377056} + - {fileID: 1931308735} + - {fileID: 1073973762} + - {fileID: 1229041066} + - {fileID: 56751283} + - {fileID: 1988936578} + - {fileID: 353408739} + - {fileID: 746759203} + - {fileID: 290590332} + - {fileID: 2045252512} + - {fileID: 1434614528} + - {fileID: 368348656} + - {fileID: 1934762264} + - {fileID: 519649707} + - {fileID: 1350115731} + - {fileID: 1675838108} + - {fileID: 1875180451} + - {fileID: 1507269762} + - {fileID: 1038353159} + - {fileID: 471382084} + - {fileID: 938057646} + - {fileID: 1927382521} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!21 &352855906 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORRAMP_ON + - FISHEYE_ON + - POSTERIZE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: a9058d3dd9b9dd14cbc6b16db7859653, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &353408738 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 353408739} + - component: {fileID: 353408742} + - component: {fileID: 353408741} + - component: {fileID: 353408740} + m_Layer: 0 + m_Name: Hallucination + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &353408739 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 9.51, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &353408740 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &353408741 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &353408742 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 353408738} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 832006925} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &356332865 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 356332866} + - component: {fileID: 356332869} + - component: {fileID: 356332868} + - component: {fileID: 356332867} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &356332866 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 564363701} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &356332867 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &356332868 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 478667331} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &356332869 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 356332865} + m_CullTransparentMesh: 0 +--- !u!1 &368348655 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 368348656} + - component: {fileID: 368348658} + - component: {fileID: 368348659} + - component: {fileID: 368348657} + m_Layer: 0 + m_Name: Ghost + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &368348656 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 20.410002, y: -5.1999993, z: 0} + m_LocalScale: {x: 0.78757, y: 0.78757, z: 0.78757} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 16 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &368348657 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &368348658 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 426087588} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &368348659 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 368348655} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &423033871 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - FADE_ON + - OUTBASE8DIR_ON + - PINCH_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: dbaa905cec0d2b944b5d1ebdbc3ceb1e, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.25 + - _FadeBurnGlow: 1.9 + - _FadeBurnTransition: 0.274 + - _FadeBurnWidth: 0.07 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0141 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 0, g: 0.9400835, b: 1, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.94117653, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &426087588 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - DOODLE_ON + - FISHEYE_ON + - GHOST_ON + - WAVEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.296 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1.41 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &429931735 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORRAMP_ON + - HSV_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - OUTTEX_ON + - PINCH_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + - _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: b3cfc9bf16a1cfa4ab153965dff63ad3, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 1.205 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 0 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1.12 + - _HsvSaturation: 1.76 + - _HsvShift: 189 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.8 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.03 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.148 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0, g: 0.80679727, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &471382083 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 471382084} + - component: {fileID: 471382086} + - component: {fileID: 471382087} + - component: {fileID: 471382085} + m_Layer: 0 + m_Name: Inner Outline + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &471382084 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 4.2400002, y: -5.1999993, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 24 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &471382085 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &471382086 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1691765423} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &471382087 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 471382083} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &478667331 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GRADIENT_ON + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 1, g: 0.27058828, b: 0.38275164, a: 1} + - _GradBotRightCol: {r: 0.8392157, g: 0, b: 0.026374353, a: 1} + - _GradTopLeftCol: {r: 0.99806374, g: 1, b: 0.4669811, a: 1} + - _GradTopRightCol: {r: 1, g: 0.66190153, b: 0.25098038, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &519649706 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 519649707} + - component: {fileID: 519649710} + - component: {fileID: 519649709} + - component: {fileID: 519649708} + m_Layer: 0 + m_Name: Rotated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &519649707 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519649706} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -10.49, y: -5.1999993, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 18 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &519649708 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519649706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &519649709 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519649706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &519649710 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519649706} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 868009891} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &520228355 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 520228356} + - component: {fileID: 520228359} + - component: {fileID: 520228358} + - component: {fileID: 520228357} + m_Layer: 0 + m_Name: Thermal Vision + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &520228356 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520228355} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 20.000002, y: 4.8000007, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &520228357 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520228355} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &520228358 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520228355} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &520228359 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 520228355} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1713942152} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &564363697 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 564363701} + - component: {fileID: 564363700} + - component: {fileID: 564363699} + - component: {fileID: 564363698} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &564363698 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &564363699 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1920, y: 1080} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &564363700 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 1 + m_Camera: {fileID: 1239183347} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &564363701 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 564363697} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 356332866} + - {fileID: 2008890717} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!21 &689553382 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - DOODLE_ON + - HSV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1.03 + - _HsvSaturation: 1.262 + - _HsvShift: 251 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &694833596 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORSWAP_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - OUTDIST_ON + - OUTTEX_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + - _OUTLINEDISTORTTOGGLE_ON + - _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 806e236bc12668e4da974bb8f536d28f, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.444 + - _ColorSwapGreenLuminosity: 0.255 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.281 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 1 + - _OutlineGlow: 4 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 0 + - _OutlineTexYSpeed: -10 + - _OutlineWidth: 0.0063 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 0.15566039, b: 0.15566039, a: 1} + - _ColorSwapGreen: {r: 1, g: 0.9654912, b: 0, a: 1} + - _ColorSwapRed: {r: 1, g: 0.40227598, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &707407687 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - FADE_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: f6a047a86109d084997a9cf4f0a2e5b0, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 0.94 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.1 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.442 + - _FadeBurnGlow: 10.3 + - _FadeBurnTransition: 0.058 + - _FadeBurnWidth: 0.051 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0.4 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.1 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 8.47 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 0.2 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 7.08 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.362 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.334 + - _HologramStripesLuminosity: 1.26 + - _HologramStripesSpeed: 3.19 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 7 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.009 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.102 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 0.004856825, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.034784317, g: 1, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0.4433962, g: 0.4433962, b: 0.4433962, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.5754717, b: 0.09929707, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &746759202 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 746759203} + - component: {fileID: 746759205} + - component: {fileID: 746759206} + - component: {fileID: 746759204} + m_Layer: 0 + m_Name: Hit Effect + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &746759203 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -5.4899993, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &746759204 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &746759205 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2033235221} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &746759206 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 746759202} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &786925990 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 786925991} + - component: {fileID: 786925994} + - component: {fileID: 786925993} + - component: {fileID: 786925992} + m_Layer: 0 + m_Name: Fish Eye + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &786925991 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 15.209999, y: -5.1999993, z: 0} + m_LocalScale: {x: 0.89757, y: 0.89757, z: 0.89757} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &786925992 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &786925993 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &786925994 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786925990} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 352855906} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &832006925 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLOW_ON + - HSV_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - OUTTEX_ON + - POLARUV_ON + - TEXTURESCROLL_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + - _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 3, y: 3} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 1.2 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0.465 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 0 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0204 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 1.13 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &868009891 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORRAMP_ON + - GLITCH_ON + - HSV_ON + - ROTATEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 763e13699209a614b8800c76fc9dee48, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 10.6 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1.15 + - _HsvSaturation: 1.33 + - _HsvShift: 114 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 3.14 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &876267714 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORRAMP_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - TEXTURESCROLL_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 4, y: 4} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 4.3 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.03 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: -1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.5309945, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &938057642 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 938057646} + - component: {fileID: 938057645} + - component: {fileID: 938057644} + - component: {fileID: 938057643} + m_Layer: 0 + m_Name: NegativeGlow + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &938057643 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 938057642} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &938057644 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 938057642} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &938057645 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 938057642} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1809645131} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &938057646 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 938057642} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 20.37, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 25 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!21 &967204686 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORSWAP_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.09 + - _ColorSwapRedLuminosity: 0.604 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapRed: {r: 0, g: 0.5643088, b: 0.8396226, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &984096427 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 984096428} + - component: {fileID: 984096430} + - component: {fileID: 984096431} + - component: {fileID: 984096429} + m_Layer: 0 + m_Name: Gradient + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &984096428 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.4899993, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &984096429 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &984096430 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1899749361} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &984096431 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984096427} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1027409867 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - DOODLE_ON + - FISHEYE_ON + - GLOW_ON + - GREYSCALE_ON + - TWISTUV_ON + - WAVEUV_ON + - WIND_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 0.95 + - _ClipUvRight: 0.95 + - _ClipUvUp: 0.95 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.061 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 1.5 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: -0.08 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 10 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 0.9780377, b: 0, a: 1} + - _HitEffectColor: {r: 1, g: 0.08018869, b: 0.08018869, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1038353158 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1038353159} + - component: {fileID: 1038353162} + - component: {fileID: 1038353161} + - component: {fileID: 1038353160} + m_Layer: 0 + m_Name: Impact + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1038353159 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -20.269999, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 23 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1038353160 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1038353161 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1038353162 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038353158} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1450236711} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1072076325 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORSWAP_ON + - GLOWTEX_ON + - GLOW_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - OUTDIST_ON + - OUTTEX_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + - _OUTLINEDISTORTTOGGLE_ON + - _OUTLINETEXTOGGLE_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: f96aebb9bcd1e3b44bafbb23b1bdac88, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.128 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 6.1 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.125 + - _OutlineDistortTexXSpeed: 0 + - _OutlineDistortTexYSpeed: -4 + - _OutlineDistortToggle: 1 + - _OutlineGlow: 11 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 1 + - _OutlineTexXSpeed: 1 + - _OutlineTexYSpeed: -5 + - _OutlineWidth: 0.0172 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 8.95 + - _WaveSpeed: 12.14 + - _WaveStrength: 18.77 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.3490566, g: 0.3490566, b: 0.3490566, a: 1} + - _ColorSwapGreen: {r: 1, g: 0.11792451, b: 0.11792451, a: 1} + - _ColorSwapRed: {r: 0.6603774, g: 0.6603774, b: 0.6603774, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.990566, g: 0.1448469, b: 0.1448469, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!4 &1073973762 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 4.5100007, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1073973763 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1073973762} + - component: {fileID: 1073973765} + - component: {fileID: 1073973766} + - component: {fileID: 1073973764} + m_Layer: 0 + m_Name: Outline3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1073973764 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1073973765 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 694833596} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1073973766 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1073973763} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1119325821 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1119325822} + - component: {fileID: 1119325826} + - component: {fileID: 1119325825} + - component: {fileID: 1119325824} + m_Layer: 0 + m_Name: Twist + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1119325822 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 15.269999, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1119325824 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1119325825 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1119325826 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1119325821} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1027409867} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1229041065 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1229041066} + - component: {fileID: 1229041068} + - component: {fileID: 1229041069} + - component: {fileID: 1229041067} + m_Layer: 0 + m_Name: HueShift + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1229041066 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -15.49, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1229041067 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1229041068 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 689553382} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1229041069 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1229041065} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1239183345 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1239183348} + - component: {fileID: 1239183347} + - component: {fileID: 1239183346} + - component: {fileID: 1239183350} + - component: {fileID: 1239183349} + m_Layer: 4 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1239183346 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1239183345} + m_Enabled: 1 +--- !u!20 &1239183347 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1239183345} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.2924528, g: 0.2924528, b: 0.2924528, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 125 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 1 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1239183348 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1239183345} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -20} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1239183349 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1239183345} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3} + m_Name: + m_EditorClassIdentifier: + sharedProfile: {fileID: 11400000, guid: c12f806a2a3ae954ebb1771c65441e4c, type: 2} + isGlobal: 1 + blendDistance: 0 + weight: 1 + priority: 0 +--- !u!114 &1239183350 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1239183345} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} + m_Name: + m_EditorClassIdentifier: + volumeTrigger: {fileID: 1239183348} + volumeLayer: + serializedVersion: 2 + m_Bits: 16 + stopNaNPropagation: 1 + finalBlitToCameraTarget: 0 + antialiasingMode: 0 + temporalAntialiasing: + jitterSpread: 0.75 + sharpness: 0.25 + stationaryBlending: 0.95 + motionBlending: 0.85 + subpixelMorphologicalAntialiasing: + quality: 2 + fastApproximateAntialiasing: + fastMode: 0 + keepAlpha: 0 + fog: + enabled: 1 + excludeSkybox: 1 + debugLayer: + lightMeter: + width: 512 + height: 256 + showCurves: 1 + histogram: + width: 512 + height: 256 + channel: 3 + waveform: + exposure: 0.12 + height: 256 + vectorscope: + size: 256 + exposure: 0.12 + overlaySettings: + linearDepth: 0 + motionColorIntensity: 4 + motionGridSize: 64 + colorBlindnessType: 0 + colorBlindnessStrength: 1 + m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2} + m_ShowToolkit: 0 + m_ShowCustomSorter: 0 + breakBeforeColorGrading: 0 + m_BeforeTransparentBundles: [] + m_BeforeStackBundles: [] + m_AfterStackBundles: [] +--- !u!1 &1350115730 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1350115731} + - component: {fileID: 1350115734} + - component: {fileID: 1350115733} + - component: {fileID: 1350115732} + m_Layer: 0 + m_Name: Evil Marine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1350115731 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -10.49, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 19 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1350115732 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1350115733 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1350115734 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1350115730} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1072076325} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1433877713 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CHROMABERR_ON + - DOODLE_ON + - FLICKER_ON + - GLITCH_ON + - GLOW_ON + - GREYSCALE_ON + - HOLOGRAM_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 0 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0.4 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.1 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 8.47 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 5.2 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 7.08 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1.4 + - _HologramMinAlpha: 0.43 + - _HologramStripesAlpha: 0.362 + - _HologramStripesAmount: 0.071 + - _HologramStripesFill: 0.334 + - _HologramStripesLuminosity: 1.26 + - _HologramStripesSpeed: 3.19 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.035 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.102 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0, g: 0.09171247, b: 0.6698113, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0.4433962, g: 0.4433962, b: 0.4433962, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 0.67701864, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.43268147, b: 0.67058825, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1434614527 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1434614528} + - component: {fileID: 1434614530} + - component: {fileID: 1434614531} + - component: {fileID: 1434614529} + m_Layer: 0 + m_Name: Negative + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1434614528 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.4899993, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1434614529 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1434614530 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1889875392} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1434614531 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434614527} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!21 &1450236711 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - CHROMABERR_ON + - FISHEYE_ON + - HITEFFECT_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - PINCH_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.249 + - _ChromAberrAmount: 0.563 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 0 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 224 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 2 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.021 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.075 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.9094448, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1455058978 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - DISTORT_ON + - FLICKER_ON + - GREYSCALE_ON + - HOLOGRAM_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.4 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 0 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 2.24 + - _HologramMinAlpha: 0.284 + - _HologramStripesAlpha: 0.815 + - _HologramStripesAmount: 0.087 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 0.62 + - _HologramStripesSpeed: 4.26 + - _HologramUnmodAmount: 0.061 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0, g: 0.80679727, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 0.88246155, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1507269761 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1507269762} + - component: {fileID: 1507269766} + - component: {fileID: 1507269765} + - component: {fileID: 1507269764} + m_Layer: 0 + m_Name: TwistFace + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1507269762 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.5999999, y: -5.1999993, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 22 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1507269764 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1507269765 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1507269766 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1507269761} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 173818797} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1675838107 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1675838108} + - component: {fileID: 1675838112} + - component: {fileID: 1675838111} + - component: {fileID: 1675838110} + m_Layer: 0 + m_Name: Army + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1675838108 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 9.359999, y: 4.8000007, z: 0} + m_LocalScale: {x: 0.88, y: 0.88, z: 0.88} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 20 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1675838110 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1675838111 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1675838112 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1675838107} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 876267714} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1691765423 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - INNEROUTLINE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 6.9 + - _InnerOutlineThickness: 3 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0.2028302, b: 0.9452239, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1713942152 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - BLUR_ON + - COLORRAMP_ON + - GLOW_ON + - NEGATIVE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 763e13699209a614b8800c76fc9dee48, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: -0.238 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 0.5 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1789615841 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORRAMP_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - RADIALGRADIENT_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GRADISRADIAL_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 763e13699209a614b8800c76fc9dee48, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 2, y: 2} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0 + - _GradBoostX: 0.77 + - _GradBoostY: 1.2 + - _GradIsRadial: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 15 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.035 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1807806170 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORRAMP_ON + - GLOWTEX_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - PIXELATE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 285a35f6ccf7b1a44b6c198e96105173, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 2800000, guid: 065da6c7b90ca904dab9cbc6b415fd19, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.975 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.75 + - _ColorSwapGreenLuminosity: 0.264 + - _ColorSwapRedLuminosity: 0.75 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.437 + - _FadeBurnGlow: 6.6 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 2.5 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 6.9 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0539 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 40 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 1.61 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 0.41037738, g: 0.5180799, b: 1, a: 1} + - _ColorSwapGreen: {r: 0, g: 1, b: 0.96124196, a: 1} + - _ColorSwapRed: {r: 0.9528302, g: 0.783215, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1809645131 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLOWTEX_ON + - GLOW_ON + - GREYSCALE_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 5.6 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.008 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.13536787, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1847541096 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - BLUR_ON + - GREYSCALE_ON + - OUTBASE8DIR_ON + - WIND_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 8 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0159 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 0, g: 0.745283, b: 0.044833504, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1875180450 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1875180451} + - component: {fileID: 1875180455} + - component: {fileID: 1875180454} + - component: {fileID: 1875180453} + m_Layer: 0 + m_Name: Teleport + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1875180451 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -5.4899993, y: -0.19999897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 21 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1875180453 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1875180454 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1875180455 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1875180450} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 423033871} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &1889875392 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - NEGATIVE_ON + - SHAKEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 1.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!21 &1899749361 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GRADIENT_ON + - SHADOW_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 0.858 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.155 + - _ShadowY: -0.081 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &1927382520 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1927382521} + - component: {fileID: 1927382525} + - component: {fileID: 1927382524} + - component: {fileID: 1927382523} + m_Layer: 0 + m_Name: Toxic + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1927382521 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1927382520} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 9.689999, y: -5.1999993, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 26 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1927382523 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1927382520} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1927382524 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1927382520} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1927382525 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1927382520} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 707407687} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1931308734 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1931308735} + - component: {fileID: 1931308737} + - component: {fileID: 1931308738} + - component: {fileID: 1931308736} + m_Layer: 0 + m_Name: Color Swap + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1931308735 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -20.49, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1931308736 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1931308737 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 967204686} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1931308738 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1931308734} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1934762263 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1934762264} + - component: {fileID: 1934762267} + - component: {fileID: 1934762266} + - component: {fileID: 1934762265} + m_Layer: 0 + m_Name: Burn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1934762264 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -5.7000003, y: -5.1999993, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1934762265 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &1934762266 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &1934762267 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934762263} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2144125442} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1988936577 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1988936578} + - component: {fileID: 1988936580} + - component: {fileID: 1988936581} + - component: {fileID: 1988936579} + m_Layer: 0 + m_Name: Color Ramp + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1988936578 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -10.49, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1988936579 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &1988936580 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1789615841} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1988936581 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1988936577} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2008890716 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2008890717} + - component: {fileID: 2008890719} + - component: {fileID: 2008890718} + m_Layer: 5 + m_Name: SceneDescription + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2008890717 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2008890716} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 564363701} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -400} + m_SizeDelta: {x: 1433.1, y: 111.5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2008890718 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2008890716} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_FontSize: 98 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 225 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: Effects will automatically scroll when in playmode +--- !u!222 &2008890719 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2008890716} + m_CullTransparentMesh: 0 +--- !u!21 &2033235221 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - HITEFFECT_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 0.379 + - _HitEffectGlow: 11 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 0, g: 0.7054799, b: 0.8207547, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!1 &2045252511 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2045252512} + - component: {fileID: 2045252515} + - component: {fileID: 2045252514} + - component: {fileID: 2045252513} + m_Layer: 0 + m_Name: Hologram + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2045252512 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 14.51, y: 4.8000007, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 298946312} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2045252513 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 4 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &2045252514 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &2045252515 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045252511} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 1433877713} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!21 &2144125442 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1SpriteShader/AllIn1SpriteShader + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - FADE_ON + - GLOWTEX_ON + - HITEFFECT_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: 0.415 + - _FadeBurnGlow: 15 + - _FadeBurnTransition: 0.105 + - _FadeBurnWidth: 0.026 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 3.3 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 12.82 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 0 + - _HitEffectGlow: 10.6 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: 0 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 0.6053487, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.7193959, b: 0.1273585, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 0.9622642, g: 0.10987086, b: 0, a: 1} + - _HologramStripeColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity.meta new file mode 100644 index 00000000..68cd4b42 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 63119d9cc000fdf4b96768c82b7d49b3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Demo2.unity + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity b/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity new file mode 100644 index 00000000..881149db --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity @@ -0,0 +1,1336 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 1 + m_FogColor: {r: 0.35287845, g: 0.39309406, b: 0.5019608, a: 1} + m_FogMode: 3 + m_FogDensity: 0.03 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 4890085278179872738, guid: da89fb36cf5d6c54e86071a4c68e542d, + type: 2} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &297631556 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 297631557} + - component: {fileID: 297631558} + m_Layer: 0 + m_Name: PointLights + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &297631557 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297631556} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.04} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 309637868} + - {fileID: 1340967441} + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &297631558 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 297631556} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f2560c72fbbcfe44195e240286d1d4e5, type: 3} + m_Name: + m_EditorClassIdentifier: + rotationSpeed: 45 + rotationAxis: {x: 0, y: 1, z: 0} + useLocalRotation: 0 +--- !u!1 &309637867 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 309637868} + - component: {fileID: 309637869} + m_Layer: 0 + m_Name: Point Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &309637868 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 309637867} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 2.32, z: -5} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 297631557} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!108 &309637869 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 309637867} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 2 + m_Shape: 0 + m_Color: {r: 0, g: 1, b: 0.07846761, a: 1} + m_Intensity: 10 + m_Range: 7.89 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!1 &831620395 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 831620397} + - component: {fileID: 831620396} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &831620396 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 831620395} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &831620397 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 831620395} + m_LocalRotation: {x: 0.29292005, y: -0, z: -0, w: 0.95613694} + m_LocalPosition: {x: 0, y: 5.04, z: -3.51} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 34.066, y: 0, z: 0} +--- !u!1 &1331354938 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1331354939} + - component: {fileID: 1331354942} + - component: {fileID: 1331354941} + - component: {fileID: 1331354940} + - component: {fileID: 1331354943} + m_Layer: 0 + m_Name: 2DSprite-Transparent + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1331354939 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331354938} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 29.32, y: 1.21, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4467823508785041245} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1331354940 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331354938} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 5 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!95 &1331354941 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331354938} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 2025469cc6b8be543a1b93993e746b75, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!212 &1331354942 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331354938} + m_Enabled: 1 + m_CastShadows: 2 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 2d686b7701c352240a308c7b5da3d710, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 0.43137255} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &1331354943 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331354938} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 38fbd5bf8eb2ab740896fa4bd7b94843, type: 3} + m_Name: + m_EditorClassIdentifier: + spr: {fileID: 1331354942} + isMaterialDrivenByAnimator: 1 + shadowCastingMode: 2 +--- !u!1 &1340967440 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1340967441} + - component: {fileID: 1340967442} + m_Layer: 0 + m_Name: Point Light (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1340967441 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1340967440} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 2.32, z: 5} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 297631557} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!108 &1340967442 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1340967440} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 2 + m_Shape: 0 + m_Color: {r: 1, g: 0, b: 0.0951767, a: 1} + m_Intensity: 10 + m_Range: 7.89 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!1 &1376930971 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1376930974} + - component: {fileID: 1376930973} + - component: {fileID: 1376930972} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1376930972 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1376930971} + m_Enabled: 1 +--- !u!20 &1376930973 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1376930971} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1376930974 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1376930971} + m_LocalRotation: {x: 0.27899113, y: 0, z: 0, w: 0.9602937} + m_LocalPosition: {x: 0, y: 8.36, z: -11.08} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 32.4, y: 0, z: 0} +--- !u!1 &4467823508200106856 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4467823508200106859} + - component: {fileID: 4467823508200106858} + - component: {fileID: 4467823508200106860} + - component: {fileID: 4467823508200106857} + - component: {fileID: 4467823508200106861} + m_Layer: 0 + m_Name: 2DSprite2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &4467823508200106857 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508200106856} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 5 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!212 &4467823508200106858 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508200106856} + m_Enabled: 1 + m_CastShadows: 2 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a6fac1ae6d53b7245ad918865e14c52e, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &4467823508200106859 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508200106856} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 1.15, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4467823508785041245} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &4467823508200106860 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508200106856} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: ed827ed402dcef3458313b21158b5c7c, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &4467823508200106861 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508200106856} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 38fbd5bf8eb2ab740896fa4bd7b94843, type: 3} + m_Name: + m_EditorClassIdentifier: AllIn1SpriteShaderAssembly::SpritePropertiesSync + spr: {fileID: 4467823508200106858} + isMaterialDrivenByAnimator: 1 + shadowCastingMode: 2 +--- !u!1 &4467823508418042096 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4467823508418042098} + - component: {fileID: 4467823508418042097} + - component: {fileID: 4467823508418042099} + - component: {fileID: 4467823508418042100} + - component: {fileID: 4467823508418042101} + m_Layer: 0 + m_Name: 2DSprite3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &4467823508418042097 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508418042096} + m_Enabled: 1 + m_CastShadows: 2 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 23a4e6f17bbaf66479862eb488f28181, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &4467823508418042098 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508418042096} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 6.6, y: 1.21, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4467823508785041245} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!95 &4467823508418042099 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508418042096} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 2025469cc6b8be543a1b93993e746b75, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!114 &4467823508418042100 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508418042096} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 5 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &4467823508418042101 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508418042096} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 38fbd5bf8eb2ab740896fa4bd7b94843, type: 3} + m_Name: + m_EditorClassIdentifier: AllIn1SpriteShaderAssembly::SpritePropertiesSync + spr: {fileID: 4467823508418042097} + isMaterialDrivenByAnimator: 1 + shadowCastingMode: 2 +--- !u!1 &4467823508785041244 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4467823508785041245} + m_Layer: 0 + m_Name: LitSprites + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4467823508785041245 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823508785041244} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 4467823509716073570} + - {fileID: 4467823508200106859} + - {fileID: 4467823508418042098} + - {fileID: 1331354939} + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &4467823509716073568 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4467823509716073570} + - component: {fileID: 4467823509716073569} + - component: {fileID: 4467823509716073571} + - component: {fileID: 4467823509716073572} + m_Layer: 0 + m_Name: 2DSprite1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &4467823509716073569 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823509716073568} + m_Enabled: 1 + m_CastShadows: 2 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: c597a6bd515e47a429c79f272eb6762a, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &4467823509716073570 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823509716073568} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -6.6, y: 1.32, z: 0} + m_LocalScale: {x: 1.8061016, y: 1.8061016, z: 1.8061016} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4467823508785041245} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &4467823509716073571 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823509716073568} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + currentShaderType: 5 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!114 &4467823509716073572 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467823509716073568} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 38fbd5bf8eb2ab740896fa4bd7b94843, type: 3} + m_Name: + m_EditorClassIdentifier: AllIn1SpriteShaderAssembly::SpritePropertiesSync + spr: {fileID: 4467823509716073569} + isMaterialDrivenByAnimator: 0 + shadowCastingMode: 2 +--- !u!1 &6574949516878858562 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6574949516878858574} + - component: {fileID: 6574949516878858575} + - component: {fileID: 6574949516878858572} + - component: {fileID: 6574949516878858573} + m_Layer: 0 + m_Name: Floor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &6574949516878858572 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949516878858562} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: f967997c8b2ff004ebed845351a5449c, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &6574949516878858573 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949516878858562} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 2, y: 2, z: 2} + m_Center: {x: 0, y: 0, z: 0} +--- !u!4 &6574949516878858574 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949516878858562} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -1, z: 0} + m_LocalScale: {x: 100, y: 1, z: 100} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6574949518432501818} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &6574949516878858575 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949516878858562} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &6574949517728517880 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949517728517884} + m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} + m_LocalPosition: {x: 0, y: -1, z: 27.9} + m_LocalScale: {x: 100, y: 1, z: 100} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6574949518432501818} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} +--- !u!33 &6574949517728517881 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949517728517884} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &6574949517728517884 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6574949517728517880} + - component: {fileID: 6574949517728517881} + - component: {fileID: 6574949517728517886} + - component: {fileID: 6574949517728517887} + m_Layer: 0 + m_Name: Wall + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &6574949517728517886 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949517728517884} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 38bc0196d341b5b4a9998eff3a9112b9, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &6574949517728517887 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949517728517884} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 2, y: 2, z: 2} + m_Center: {x: 0, y: 0, z: 0} +--- !u!4 &6574949518432501818 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574949518432501819} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 6574949516878858574} + - {fileID: 6574949517728517880} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &6574949518432501819 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6574949518432501818} + m_Layer: 0 + m_Name: Environment + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity.meta new file mode 100644 index 00000000..e8a3ac85 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 86d599b29c3c772489a054510b3caf0c +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShader.unity + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShaderSettings.lighting b/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShaderSettings.lighting new file mode 100644 index 00000000..c904ac7a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShaderSettings.lighting @@ -0,0 +1,69 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!850595691 &4890085278179872738 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DemoLitShaderSettings + serializedVersion: 10 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 1 + m_BakeBackend: 1 + m_LightmapMaxSize: 1024 + m_LightmapSizeFixed: 0 + m_UseMipmapLimits: 1 + m_BakeResolution: 40 + m_Padding: 2 + m_LightmapCompression: 3 + m_LightmapPackingMode: 1 + m_LightmapPackingMethod: 0 + m_XAtlasPackingAttempts: 16384 + m_XAtlasBruteForce: 0 + m_XAtlasBlockAlign: 0 + m_XAtlasRepackUnderutilizedLightmaps: 1 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 2 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} + m_ExportTrainingData: 0 + m_EnableWorkerProcessBaking: 1 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 2 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRMinBounces: 2 + m_PVREnvironmentImportanceSampling: 1 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_RespectSceneVisibilityWhenBakingGI: 0 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShaderSettings.lighting.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShaderSettings.lighting.meta new file mode 100644 index 00000000..ef8815f0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShaderSettings.lighting.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: da89fb36cf5d6c54e86071a4c68e542d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 4890085278179872738 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/DemoLitShaderSettings.lighting + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts.meta new file mode 100644 index 00000000..2f4081d0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c2e2455655940ed4ca1596166ba120ca +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams.ttf b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams.ttf new file mode 100644 index 00000000..852f4546 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams.ttf differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams.ttf.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams.ttf.meta new file mode 100644 index 00000000..517f97ce --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams.ttf.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: 8125849ac2a1e6742b3cad98aa210e2d +TrueTypeFontImporter: + externalObjects: {} + serializedVersion: 4 + fontSize: 16 + forceTextureCase: -2 + characterSpacing: 0 + characterPadding: 1 + includeFontData: 1 + fontName: Caviar Dreams + fontNames: + - Caviar Dreams + fallbackFontReferences: [] + customCharacters: + fontRenderingMode: 0 + ascentCalculationMode: 1 + useLegacyBoundsCalculation: 0 + shouldRoundAdvanceValue: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams.ttf + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams_Bold.ttf b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams_Bold.ttf new file mode 100644 index 00000000..0a3fe6de Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams_Bold.ttf differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams_Bold.ttf.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams_Bold.ttf.meta new file mode 100644 index 00000000..fbca2596 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams_Bold.ttf.meta @@ -0,0 +1,30 @@ +fileFormatVersion: 2 +guid: 868b1fc2a144d3d459c5f34d64b52eb0 +TrueTypeFontImporter: + externalObjects: {} + serializedVersion: 4 + fontSize: 16 + forceTextureCase: -2 + characterSpacing: 0 + characterPadding: 1 + includeFontData: 1 + fontName: Caviar Dreams + fontNames: + - Caviar Dreams + fallbackFontReferences: + - {fileID: 12800000, guid: 8125849ac2a1e6742b3cad98aa210e2d, type: 3} + customCharacters: + fontRenderingMode: 0 + ascentCalculationMode: 1 + useLegacyBoundsCalculation: 0 + shouldRoundAdvanceValue: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/CaviarDreams_Bold.ttf + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf new file mode 100644 index 00000000..a24f91dd Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf.meta new file mode 100644 index 00000000..363bcdd1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: d722354f9c8e9e643b5f30f00b5b20ea +TrueTypeFontImporter: + externalObjects: {} + serializedVersion: 4 + fontSize: 16 + forceTextureCase: -2 + characterSpacing: 0 + characterPadding: 1 + includeFontData: 1 + fontName: Poetsen One + fontNames: + - Poetsen One + fallbackFontReferences: [] + customCharacters: + fontRenderingMode: 0 + ascentCalculationMode: 1 + useLegacyBoundsCalculation: 0 + shouldRoundAdvanceValue: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Fonts/PoetsenOne-Regular.ttf + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials.meta new file mode 100644 index 00000000..53636436 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ddc21e094ffb34f4389bb47b77d54f47 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat new file mode 100644 index 00000000..f19eaede --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat @@ -0,0 +1,311 @@ +%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: Color Ramp Gradient + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - COLORRAMP_ON + - GRADIENTCOLORRAMP_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWAFFECTLIGHT_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 28596166879787490} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _MaskTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowAffectLight: 1 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _LitAmount: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!28 &28596166879787490 +Texture2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: z_ColorRampTexGradientTex{"mode":0,"colorKeys":[{"color":{"r":0.25045204162597659,"g":0.0,"b":1.0,"a":1.0},"time":0.0},{"color":{"r":1.0,"g":0.0,"b":0.3670511245727539,"a":1.0},"time":0.30406653881073},{"color":{"r":1.0,"g":0.8852795958518982,"b":0.49803924560546877,"a":1.0},"time":0.6081483364105225},{"color":{"r":1.0,"g":0.7620869874954224,"b":0.0,"a":1.0},"time":0.6730296611785889},{"color":{"r":1.0,"g":0.21687757968902589,"b":0.15294116735458375,"a":1.0},"time":0.921126127243042},{"color":{"r":1.0,"g":0.9718939661979675,"b":0.0,"a":1.0},"time":1.0}],"alphaKeys":[{"alpha":1.0,"time":0.0},{"alpha":1.0,"time":1.0}]} + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + m_IsAlphaChannelOptional: 0 + serializedVersion: 2 + m_Width: 64 + m_Height: 1 + m_CompleteImageSize: 256 + m_MipsStripped: 0 + m_TextureFormat: 4 + m_MipCount: 1 + m_IsReadable: 1 + m_IsPreProcessed: 0 + m_IgnoreMasterTextureLimit: 0 + m_StreamingMipmaps: 0 + m_StreamingMipmapsPriority: 0 + m_VTOnly: 0 + m_AlphaIsTransparency: 0 + m_ImageCount: 1 + m_TextureDimension: 2 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 1 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_LightmapFormat: 0 + m_ColorSpace: 1 + m_PlatformBlob: + image data: 256 + _typelessdata: 4000ffff4a00f7ff5400eeff5e00e6ff6800ddff7200d5ff7c00ccff8600c4ff9000bcff9a00b3ffa400abffae00a2ffb8009affc20091ffcc0089ffd60081ffe00078ffe90070fff30067fffd005fffff0a5fffff1661ffff2263ffff2d64ffff3966ffff4568ffff516affff5c6bffff686dffff746fffff8071ffff8c72ffff9774ffffa376ffffaf77ffffbb79ffffc67bffffd27dffffde7effffdc6affffd54bffffcd2cffffc50cffffbd01ffffb404ffffab06ffffa209ffff990bffff910effff8810ffff7f13ffff7615ffff6d18ffff641affff5b1dffff521fffff4922ffff4024ffff3827ffff5d1fffff8418ffffaa10ffffd108fffff800ff + m_StreamData: + serializedVersion: 2 + offset: 0 + size: 0 + path: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat.meta new file mode 100644 index 00000000..c34671bc --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1c07bf10ccbd5c643b7a3d99b400a745 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Color Ramp Gradient.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat new file mode 100644 index 00000000..1c16f8de --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat @@ -0,0 +1,316 @@ +%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: DemoGradient + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - ALPHAOUTLINE_ON + - COLORRAMP_ON + - GRADIENTCOLORRAMP_ON + - HSV_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWAFFECTLIGHT_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 28726713437276524} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _MaskTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 77.9 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 0 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowAffectLight: 1 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 12.2 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 0.97 + - _HsvSaturation: 1.3 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _LitAmount: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 6 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.037 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 0.2 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 0.66800976, g: 0, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 0.7803922, g: 0.3137255, b: 0.94117653, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.6425381, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!28 &28726713437276524 +Texture2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: z_ColorRampTexGradientTex{"mode":0,"colorKeys":[{"color":{"r":0.0,"g":0.0815119743347168,"b":1.0,"a":1.0},"time":0.0},{"color":{"r":0.3421383202075958,"g":0.0,"b":0.6415094137191773,"a":1.0},"time":0.24681468307971955},{"color":{"r":0.778521716594696,"g":0.5283018946647644,"b":1.0,"a":1.0},"time":0.4923628568649292},{"color":{"r":1.0,"g":0.2666666507720947,"b":0.8437959551811218,"a":1.0},"time":0.7340962886810303},{"color":{"r":0.13333332538604737,"g":0.21844977140426637,"b":1.0,"a":1.0},"time":0.8664072751998901},{"color":{"r":0.0,"g":0.9796860218048096,"b":1.0,"a":1.0},"time":1.0}],"alphaKeys":[{"alpha":1.0,"time":0.0},{"alpha":1.0,"time":1.0}]} + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + m_IsAlphaChannelOptional: 0 + serializedVersion: 2 + m_Width: 64 + m_Height: 1 + m_CompleteImageSize: 256 + m_MipsStripped: 0 + m_TextureFormat: 4 + m_MipCount: 1 + m_IsReadable: 1 + m_IsPreProcessed: 0 + m_IgnoreMasterTextureLimit: 0 + m_StreamingMipmaps: 0 + m_StreamingMipmapsPriority: 0 + m_VTOnly: 0 + m_AlphaIsTransparency: 0 + m_ImageCount: 1 + m_TextureDimension: 2 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 1 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_LightmapFormat: 0 + m_ColorSpace: 1 + m_PlatformBlob: + image data: 256 + _typelessdata: 0015ffff0613f9ff0b12f3ff1111edff160fe7ff1c0ee2ff220ddcff270bd6ff2d0ad0ff3209caff3807c4ff3e06beff4305b8ff4903b3ff4f02adff5401a7ff5a04a6ff620dacff6915b2ff701eb8ff7727beff7e2fc4ff8638caff8d41d0ff944ad6ff9b52dbffa25be1ffaa64e7ffb16cedffb875f3ffbf7ef9ffc687ffffca82fcffce7efaffd27af7ffd575f5ffd971f2ffdd6defffe068edffe464eaffe85fe8ffec5be5ffef57e2fff352e0fff74eddfffa49dafffe45d8ffeb43dbffd141e0ffb640e4ff9c3ee9ff813deeff663cf3ff4c3af7ff3139fcff2041ffff1c58ffff186fffff1486ffff109effff0cb5ffff08ccffff04e3ffff00faffff + m_StreamData: + serializedVersion: 2 + offset: 0 + size: 0 + path: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat.meta new file mode 100644 index 00000000..16abe0a9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 473fd0e814452c4488d6794c3f24dff1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/DemoGradient.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat new file mode 100644 index 00000000..f7b2f1a1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat @@ -0,0 +1,306 @@ +%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: Fire + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - FADE_ON + - GLOWTEX_ON + - GLOW_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 487cb2374bc49b848a1f4577212201cc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: be304275dbf36014ca9828884588ac47, type: 3} + m_Scale: {x: 0.6, y: 0.6} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 0.488 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 30 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 0.1 + - _TextureScrollYSpeed: 0.1 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.5103101, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] +--- !u!28 &1224435869679222136 +Texture2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: z_ColorRampTexGradientTex + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + m_IsAlphaChannelOptional: 0 + serializedVersion: 2 + m_Width: 64 + m_Height: 1 + m_CompleteImageSize: 256 + m_MipsStripped: 0 + m_TextureFormat: 4 + m_MipCount: 1 + m_IsReadable: 1 + m_IsPreProcessed: 0 + m_IgnoreMasterTextureLimit: 0 + m_StreamingMipmaps: 0 + m_StreamingMipmapsPriority: 0 + m_VTOnly: 0 + m_AlphaIsTransparency: 0 + m_ImageCount: 1 + m_TextureDimension: 2 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 1 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_LightmapFormat: 0 + m_ColorSpace: 1 + m_PlatformBlob: + image data: 256 + _typelessdata: cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd + m_StreamData: + serializedVersion: 2 + offset: 0 + size: 0 + path: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat.meta new file mode 100644 index 00000000..e23e21da --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a186aad8f5f9dd04d910c7e3174834c0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Fire.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat new file mode 100644 index 00000000..bd64af47 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat @@ -0,0 +1,272 @@ +%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: FireSoldier + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLOWTEX_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWAFFECTLIGHT_ON + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _MaskTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 8.5 + - _GlowAffectLight: 1 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 2 + - _HsvShift: 151 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _LitAmount: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.011 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 0.9703183, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.29168093, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat.meta new file mode 100644 index 00000000..78f01de5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: cd0693e274874cc4f8ffd67a41ebe801 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/FireSoldier.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat new file mode 100644 index 00000000..50056759 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat @@ -0,0 +1,257 @@ +%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: Ice + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - FADE_ON + - GLOW_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 0.55 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 1.5 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.056 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 0.6 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 0, g: 0.9150943, b: 0.8972679, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat.meta new file mode 100644 index 00000000..104048c9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e4599046180b0ac49b3df99ab01b3e27 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Ice.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat new file mode 100644 index 00000000..35737476 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat @@ -0,0 +1,274 @@ +%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: IceSoldier + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLOWTEX_ON + - GLOW_ON + - HSV_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWAFFECTLIGHT_ON + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _MaskTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 4.5 + - _GlowAffectLight: 1 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1.62 + - _HsvShift: 271 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _LitAmount: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 2.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.018 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.09103775, g: 1, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0.06866193, g: 1, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat.meta new file mode 100644 index 00000000..1fe39e3e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: d27799974f79b894196aeeef8bac53af +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/IceSoldier.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat new file mode 100644 index 00000000..57da315d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat @@ -0,0 +1,318 @@ +%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: LitFloor + m_Shader: {fileID: 4800000, guid: 86ce7e600deb17e429b8be445bb652f7, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + 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} + - _ColorRampTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + 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} + - _DistortTex: + 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} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: fd279c0d74378ff48b61c27ffc8873eb, type: 3} + m_Scale: {x: 8, y: 8} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 2800000, guid: 47c3680e2892fa44b80abb6447b1a619, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + 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} + - _ShineMask: + 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: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _BumpScale: 1 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _DstBlend: 0 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _Metallic: 0 + - _MinXUV: 0 + - _MinYUV: 0 + - _Mode: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 2.86 + - _OcclusionStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 1.5 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _Parallax: 0.02 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _QueueControl: -1 + - _QueueOffset: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _UVSec: 0 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _DistortTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _FadeBurnTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _FadeTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _MainTex_ScaleAndTiling: {r: 10, g: 10, b: 0, a: 0} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OutlineDistortTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OutlineTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + - _SpriteFlip: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat.meta new file mode 100644 index 00000000..c7712e1f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: f967997c8b2ff004ebed845351a5449c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitFloor.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat new file mode 100644 index 00000000..f12fa990 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat @@ -0,0 +1,268 @@ +%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: LitSprite1 + m_Shader: {fileID: 4800000, guid: 86ce7e600deb17e429b8be445bb652f7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - COLORRAMP_ON + - HSV_ON + - INNEROUTLINE_ON + - NORMALMAP_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - TWISTUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 7062336ff4b66994caa2ba23c8651342, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _NormalMap: + m_Texture: {fileID: 2800000, guid: 994e4deee74379d4c83bcf0f27585f73, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0.051 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 7 + - _FadeAmount: 0.169 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 13.02 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1.102 + - _HsvShift: 360 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 15 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 100 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0232 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.32 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _DistortTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _FadeBurnTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _FadeTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _MainTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OutlineDistortTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OutlineTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + - _SpriteFlip: {r: 1, g: 1, b: 0, a: 0} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat.meta new file mode 100644 index 00000000..1313af67 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a6fac1ae6d53b7245ad918865e14c52e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite1.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat new file mode 100644 index 00000000..e0832aba --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat @@ -0,0 +1,275 @@ +%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: LitSprite2 + m_Shader: {fileID: 4800000, guid: 86ce7e600deb17e429b8be445bb652f7, type: 3} + m_ValidKeywords: + - DOODLE_ON + - HSV_ON + - NORMALMAP_ON + - PINCH_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: fcb027caad6963b4a80539bbce0d10e9, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _NormalMap: + m_Texture: {fileID: 2800000, guid: 994e4deee74379d4c83bcf0f27585f73, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + 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: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.184 + - _DistortTexXSpeed: 0 + - _DistortTexYSpeed: 0 + - _EditorDrawers: 7 + - _FadeAmount: 0.169 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 13.02 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1.213 + - _HsvShift: 221 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 10 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 100 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0151 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.139 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _QueueControl: -1 + - _QueueOffset: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.42 + - _TwistUvPosX: 0.316 + - _TwistUvPosY: 0.755 + - _TwistUvRadius: 0.54 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _DistortTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _FadeBurnTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _FadeTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _MainTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OutlineDistortTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OutlineTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + - _SpriteFlip: {r: 1, g: 1, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat.meta new file mode 100644 index 00000000..591a1636 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c597a6bd515e47a429c79f272eb6762a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite2.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat new file mode 100644 index 00000000..61e52987 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat @@ -0,0 +1,276 @@ +%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: LitSprite3 + m_Shader: {fileID: 4800000, guid: 86ce7e600deb17e429b8be445bb652f7, type: 3} + m_ValidKeywords: + - FADE_ON + - GRADIENT_ON + - NORMALMAP_ON + - RADIALGRADIENT_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GRADISRADIAL_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.3, y: 0.3} + m_Offset: {x: -0.16, y: 0.08} + - _GlowTex: + 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} + - _NormalMap: + m_Texture: {fileID: 2800000, guid: 994e4deee74379d4c83bcf0f27585f73, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + 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: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 7 + - _FadeAmount: 0.275 + - _FadeBurnGlow: 250 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 0.609 + - _GradBoostX: 1.02 + - _GradBoostY: 1.2 + - _GradIsRadial: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 13.02 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1.213 + - _HsvShift: 221 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 10 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 100 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.0151 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _QueueControl: -1 + - _QueueOffset: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7.9 + - _WaveSpeed: 10 + - _WaveStrength: 18.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _DistortTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _FadeBurnTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _FadeTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 1, g: 0, b: 0.6043663, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 0.044267416, g: 1, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _MainTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OutlineDistortTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OutlineTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + - _SpriteFlip: {r: 1, g: 1, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat.meta new file mode 100644 index 00000000..6f8a4a78 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 23a4e6f17bbaf66479862eb488f28181 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSprite3.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat new file mode 100644 index 00000000..5ffc68dd --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat @@ -0,0 +1,276 @@ +%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: LitSpriteTransparent + m_Shader: {fileID: 4800000, guid: 4cab4aa8ce3e6774aa0d904ec70df88e, type: 3} + m_ValidKeywords: + - GREYSCALE_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + - POSTERIZE_ON + - WAVEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _NormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + 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: + - _Alpha: 1 + - _AlphaCutoffValue: 0.01 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 1.5 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.023 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 5.1 + - _PosterizeOutline: 0 + - _QueueControl: -1 + - _QueueOffset: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _DistortTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _FadeBurnTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _FadeTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _MainTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OutlineDistortTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OutlineTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + - _SpriteFlip: {r: 1, g: 1, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat.meta new file mode 100644 index 00000000..a0c44b4d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2d686b7701c352240a308c7b5da3d710 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitSpriteTransparent.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat new file mode 100644 index 00000000..a1df51fa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat @@ -0,0 +1,318 @@ +%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: LitWall + m_Shader: {fileID: 4800000, guid: 86ce7e600deb17e429b8be445bb652f7, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + 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} + - _ColorRampTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + 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} + - _DistortTex: + 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} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: c6ad7b22efb776c448982ca631b16f73, type: 3} + m_Scale: {x: 5, y: 5} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 2800000, guid: fdff8a56ae2c830478b84c6807aa0408, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + 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} + - _ShineMask: + 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: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _BumpScale: 1 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _DstBlend: 0 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _Metallic: 0 + - _MinXUV: 0 + - _MinYUV: 0 + - _Mode: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 5 + - _OcclusionStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 1.5 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _Parallax: 0.02 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _QueueControl: -1 + - _QueueOffset: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _UVSec: 0 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _DistortTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _FadeBurnTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _FadeTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _MainTex_ScaleAndTiling: {r: 10, g: 10, b: 0, a: 0} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OutlineDistortTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OutlineTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayTex_ScaleAndTiling: {r: 1, g: 1, b: 0, a: 0} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + - _SpriteFlip: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat.meta new file mode 100644 index 00000000..54c132b3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 38bc0196d341b5b4a9998eff3a9112b9 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/LitWall.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat new file mode 100644 index 00000000..19f752b6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat @@ -0,0 +1,276 @@ +%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: MagicRing + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - BLUR_ON + - DISTORT_ON + - GLOW_ON + - OUTBASE8DIR_ON + - OUTBASEPIXELPERF_ON + - OUTBASE_ON + - PINCH_ON + - RADIALGRADIENT_ON + - ROTATEUV_ON + - TWISTUV_ON + - WAVEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWAFFECTLIGHT_ON + - _GRADISRADIAL_ON + - _OUTLINE8DIRECTIONS_ON + - _OUTLINEISPIXEL_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 0.5, y: 0.5} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _MaskTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 0.9 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 100 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 1 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.79 + - _DistortTexXSpeed: -1 + - _DistortTexYSpeed: -10 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 0 + - _GhostTransparency: 0.017 + - _GlitchAmount: 20 + - _GlitchSize: 4.51 + - _GlitchSpeed: 20 + - _Glow: 33.6 + - _GlowAffectLight: 1 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 5 + - _GradBoostY: 1.2 + - _GradIsRadial: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 2 + - _HsvSaturation: 2 + - _HsvShift: 360 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 250 + - _InnerOutlineThickness: 3 + - _LitAmount: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: -1 + - _MotionBlurDist: 3 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 0.306 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1 + - _OutlineIsPixel: 1 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0 + - _PixelateSize: 20 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 6.28 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 71.6 + - _ShineLocation: 0.5 + - _ShineRotate: 1.28 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 0.47 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.91 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 1.95 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 0.9044944, b: 0, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0.4339623, g: 0.30433717, b: 0, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 0.7998638, b: 0, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat.meta new file mode 100644 index 00000000..06bb7306 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 1c2c3a51f881cb443906a57116cf56fe +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/MagicRing.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat new file mode 100644 index 00000000..042b3742 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat @@ -0,0 +1,268 @@ +%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: Outline1 + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWAFFECTLIGHT_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _MaskTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowAffectLight: 1 + - _GlowGlobal: 1 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _LitAmount: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 3 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.025 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat.meta new file mode 100644 index 00000000..93fc55fe --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 2fff2435ee99439438c463e2ce768283 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Outline1.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat new file mode 100644 index 00000000..1c05ef70 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat @@ -0,0 +1,265 @@ +%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: Shield + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - BLURISHD_ON + - FADE_ON + - FLICKER_ON + - GLOWTEX_ON + - GLOW_ON + - PIXELATE_ON + - TEXTURESCROLL_ON + - WAVEUV_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _BLURHD_ON + - _GLOWTEXUSED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: dbaa905cec0d2b944b5d1ebdbc3ceb1e, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 81687001a52d8024fb3706ba7619ad4b, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 2f5c9cbfde2d0384bb53189b0d0f06d8, type: 3} + m_Scale: {x: 1.5, y: 1.5} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 0.332 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 1 + - _BlurIntensity: 13.7 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 5.7 + - _FadeBurnTransition: 0.095 + - _FadeBurnWidth: 0 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0.888 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3.4 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 10 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 35.7 + - _HologramStripesFill: 0.27 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 0 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.014 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 66 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 0.24 + - _TextureScrollYSpeed: 0.31 + - _TwistUvAmount: 0.46 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 15 + - _WaveSpeed: 24.7 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 0, g: 0.9805136, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 1, a: 1} + - _GlowColor: {r: 0, g: 0.98090506, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 1, b: 0.9378109, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat.meta new file mode 100644 index 00000000..a4ea9c44 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 4396a2d1265c9414e810fdf77d8238b5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Shield.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat new file mode 100644 index 00000000..027e6360 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat @@ -0,0 +1,273 @@ +%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: ShieldSoldier + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: + - GLOWTEX_ON + - HSV_ON + - OUTBASE8DIR_ON + - OUTBASE_ON + m_InvalidKeywords: + - ETC1_EXTERNAL_ALPHA + - _GLOWAFFECTLIGHT_ON + - _GLOWTEXUSED_ON + - _OUTLINE8DIRECTIONS_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 2800000, guid: 8608ef90f91271745a17f7210fe1e7db, type: 3} + 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} + - _MaskTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _EditorDrawers: 6 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 20 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _Glow: 6.9 + - _GlowAffectLight: 1 + - _GlowGlobal: 1 + - _GlowTexUsed: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 2 + - _HsvShift: 163 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _LitAmount: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _NormalStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 1 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 3 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.011 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 0, g: 0.23854972, b: 0.2924528, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 0, g: 0.33333334, b: 0.6666667, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat.meta new file mode 100644 index 00000000..cacc76db --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 8a80b25e622f6c84aac445df7e206085 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/ShieldSoldier.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat new file mode 100644 index 00000000..4d152744 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat @@ -0,0 +1,299 @@ +%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: SnowFlake + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _AlphaTex: + 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} + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + 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} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + 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} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: ab4465ab72ca5544da8e8dd1110b6973, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + 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} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - PixelSnap: 0 + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _BumpScale: 1 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _DstBlend: 0 + - _EditorDrawers: 6 + - _EnableExternalAlpha: 0 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _Metallic: 0 + - _MinXUV: 0 + - _MinYUV: 0 + - _Mode: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OcclusionStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 1.5 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _Parallax: 0.02 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _UVSec: 0 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 1 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _Flip: {r: 1, g: 1, b: 1, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _RendererColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat.meta new file mode 100644 index 00000000..60bb79fe --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: aae53a69b285d6f4aad0e6953245bc7d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/SnowFlake.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat new file mode 100644 index 00000000..4bba19fd --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat @@ -0,0 +1,299 @@ +%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: Sparks + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _AlphaTex: + 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} + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + 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} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + 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} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 48bde3d73ebadd04783e0c4cb7276007, type: 3} + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OverlayTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + 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} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - PixelSnap: 0 + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaOutlineBlend: 1 + - _AlphaOutlineGlow: 5 + - _AlphaOutlineMinAlpha: 0 + - _AlphaOutlinePower: 1 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _Brightness: 0 + - _BumpScale: 1 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorChangeTolerance2: 0.25 + - _ColorChangeTolerance3: 0.25 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlend: 1 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _Contrast: 1 + - _CullingOption: 0 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _DstBlend: 0 + - _EditorDrawers: 7 + - _EnableExternalAlpha: 0 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostBlend: 1 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _GlitchSpeed: 20 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Glow: 10 + - _GlowGlobal: 1 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassRadialBend: 0.1 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleBlend: 1 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramBlend: 1 + - _HologramMaxAlpha: 0.75 + - _HologramMinAlpha: 0.1 + - _HologramStripesAmount: 0.1 + - _HologramStripesSpeed: 4.5 + - _HologramUnmodAmount: 0 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 4 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _Metallic: 0 + - _MinXUV: 0 + - _MinYUV: 0 + - _Mode: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OcclusionStrength: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineGlow: 1.5 + - _OutlinePixelWidth: 1 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _OverlayBlend: 1 + - _OverlayGlow: 1 + - _OverlayTextureScrollXSpeed: 0.25 + - _OverlayTextureScrollYSpeed: 0.25 + - _Parallax: 0.02 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RadialClip: 45 + - _RadialClip2: 0 + - _RadialStartAngle: 90 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _UVSec: 0 + - _WarpScale: 0.5 + - _WarpSpeed: 8 + - _WarpStrength: 0.025 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _AlphaOutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol2: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeNewCol3: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget2: {r: 1, g: 0, b: 0, a: 1} + - _ColorChangeTarget3: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _Flip: {r: 1, g: 1, b: 1, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 1, b: 0, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 1, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _OverlayColor: {r: 1, g: 1, b: 1, a: 1} + - _RendererColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat.meta new file mode 100644 index 00000000..64058ae8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: e2fd28a60d223ba4cb25e286da19b13a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Materials/Sparks.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles.meta new file mode 100644 index 00000000..96e83dae --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fb1e0660363295c4db411edfff6675eb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/BuiltIn.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/BuiltIn.meta new file mode 100644 index 00000000..de260fca --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/BuiltIn.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3e0d4f5e01e844c40bac567df7f9c838 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/BuiltIn/AllIn1PostProcessing.asset b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/BuiltIn/AllIn1PostProcessing.asset new file mode 100644 index 00000000..a6d67309 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/BuiltIn/AllIn1PostProcessing.asset @@ -0,0 +1,108 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-5917241030525834870 +MonoBehaviour: + m_ObjectHideFlags: 3 + 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: 48a79b01ea5641d4aa6daa2e23605641, type: 3} + m_Name: Bloom + m_EditorClassIdentifier: + active: 1 + enabled: + overrideState: 1 + value: 1 + intensity: + overrideState: 1 + value: 3 + threshold: + overrideState: 1 + value: 1.5 + softKnee: + overrideState: 1 + value: 1 + clamp: + overrideState: 1 + value: 65472 + diffusion: + overrideState: 1 + value: 4.95 + anamorphicRatio: + overrideState: 1 + value: 1 + color: + overrideState: 1 + value: {r: 1, g: 1, b: 1, a: 1} + fastMode: + overrideState: 1 + value: 0 + dirtTexture: + overrideState: 0 + value: {fileID: 0} + defaultState: 1 + dirtIntensity: + overrideState: 0 + value: 0 +--- !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: 8e6292b2c06870d4495f009f912b9600, type: 3} + m_Name: AllIn1PostProcessing + m_EditorClassIdentifier: + settings: + - {fileID: 56827712184524892} + - {fileID: -5917241030525834870} +--- !u!114 &56827712184524892 +MonoBehaviour: + m_ObjectHideFlags: 3 + 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: 40b924e2dad56384a8df2a1e111bb675, type: 3} + m_Name: Vignette + m_EditorClassIdentifier: + active: 1 + enabled: + overrideState: 1 + value: 1 + mode: + overrideState: 1 + value: 0 + color: + overrideState: 1 + value: {r: 0, g: 0, b: 0, a: 1} + center: + overrideState: 1 + value: {x: 0.5, y: 0.5} + intensity: + overrideState: 1 + value: 0.409 + smoothness: + overrideState: 1 + value: 0.779 + roundness: + overrideState: 1 + value: 0.8 + rounded: + overrideState: 1 + value: 0 + mask: + overrideState: 0 + value: {fileID: 0} + defaultState: 1 + opacity: + overrideState: 0 + value: 1 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/BuiltIn/AllIn1PostProcessing.asset.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/BuiltIn/AllIn1PostProcessing.asset.meta new file mode 100644 index 00000000..7d9382e2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/BuiltIn/AllIn1PostProcessing.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c12f806a2a3ae954ebb1771c65441e4c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/BuiltIn/AllIn1PostProcessing.asset + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/Urp.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/Urp.meta new file mode 100644 index 00000000..68c9c7ec --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/Urp.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b572dd45d2b218c4a9f917aeb3ee766f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/Urp/AllIn1PostProcessing-URP.asset b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/Urp/AllIn1PostProcessing-URP.asset new file mode 100644 index 00000000..dcc97f03 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/Urp/AllIn1PostProcessing-URP.asset @@ -0,0 +1,95 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4114732372040751240 +MonoBehaviour: + m_ObjectHideFlags: 3 + 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: 899c54efeace73346a0a16faa3afe726, type: 3} + m_Name: Vignette + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.Vignette + active: 1 + color: + m_OverrideState: 1 + m_Value: {r: 0, g: 0, b: 0, a: 1} + center: + m_OverrideState: 1 + m_Value: {x: 0.5, y: 0.5} + intensity: + m_OverrideState: 1 + m_Value: 0.35 + smoothness: + m_OverrideState: 1 + m_Value: 0.2 + rounded: + m_OverrideState: 1 + m_Value: 0 +--- !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: d7fd9488000d3734a9e00ee676215985, type: 3} + m_Name: AllIn1PostProcessing-URP + m_EditorClassIdentifier: Unity.RenderPipelines.Core.Runtime::UnityEngine.Rendering.VolumeProfile + components: + - {fileID: 6249574121618810040} + - {fileID: -4114732372040751240} +--- !u!114 &6249574121618810040 +MonoBehaviour: + m_ObjectHideFlags: 3 + 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: 0b2db86121404754db890f4c8dfe81b2, type: 3} + m_Name: Bloom + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.Bloom + active: 1 + skipIterations: + m_OverrideState: 1 + m_Value: 1 + threshold: + m_OverrideState: 1 + m_Value: 1.5 + intensity: + m_OverrideState: 1 + m_Value: 1 + scatter: + m_OverrideState: 1 + m_Value: 0.7 + clamp: + m_OverrideState: 1 + m_Value: 65472 + tint: + m_OverrideState: 1 + m_Value: {r: 1, g: 1, b: 1, a: 1} + highQualityFiltering: + m_OverrideState: 1 + m_Value: 0 + filter: + m_OverrideState: 1 + m_Value: 0 + downscale: + m_OverrideState: 1 + m_Value: 0 + maxIterations: + m_OverrideState: 1 + m_Value: 6 + dirtTexture: + m_OverrideState: 0 + m_Value: {fileID: 0} + dimension: 1 + dirtIntensity: + m_OverrideState: 0 + m_Value: 0 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/Urp/AllIn1PostProcessing-URP.asset.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/Urp/AllIn1PostProcessing-URP.asset.meta new file mode 100644 index 00000000..dec59c2b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/Urp/AllIn1PostProcessing-URP.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 93a6cccfd37450b4fbd8eec2f4cc77f4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/PostProcessingProfiles/Urp/AllIn1PostProcessing-URP.asset + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs.meta new file mode 100644 index 00000000..628bd2fa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1393ecda48f2f88439763bd3d4a263ac +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab new file mode 100644 index 00000000..79757577 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab @@ -0,0 +1,5005 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7935039278030221704 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7935039278030221705} + - component: {fileID: 7935039278030221707} + - component: {fileID: 7935039278030221706} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7935039278030221705 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039278030221704} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -2.51, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7935039278937507618} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &7935039278030221707 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039278030221704} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!102 &7935039278030221706 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039278030221704} + m_Text: Particle System + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!1 &7935039278937507617 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7935039278937507618} + - component: {fileID: 7935039278937507619} + m_Layer: 0 + m_Name: Particle System Demo + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7935039278937507618 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039278937507617} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 220, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7935039279205550810} + - {fileID: 7935039278030221705} + - {fileID: 7935039279796415622} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &7935039278937507619 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039278937507617} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &7935039279205550809 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7935039279205550810} + - component: {fileID: 7935039279205550813} + - component: {fileID: 7935039279205550812} + - component: {fileID: 7935039279205550811} + m_Layer: 0 + m_Name: MagicSmokePs + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7935039279205550810 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279205550809} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 2.4465578, y: 2.4465578, z: 2.4465578} + m_Children: [] + m_Father: {fileID: 7935039278937507618} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} +--- !u!198 &7935039279205550813 +ParticleSystem: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279205550809} + serializedVersion: 6 + lengthInSec: 2 + simulationSpeed: 1 + stopAction: 0 + cullingMode: 0 + ringBufferMode: 0 + ringBufferLoopRange: {x: 0, y: 1} + looping: 1 + prewarm: 0 + playOnAwake: 1 + useUnscaledTime: 0 + autoRandomSeed: 1 + useRigidbodyForVelocity: 1 + startDelay: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + moveWithTransform: 0 + moveWithCustomTransform: {fileID: 0} + scalingMode: 1 + randomSeed: 0 + InitialModule: + serializedVersion: 3 + enabled: 1 + startLifetime: + serializedVersion: 2 + minMaxState: 0 + scalar: 2 + minScalar: 5 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSpeed: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 5 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startColor: + serializedVersion: 2 + minMaxState: 2 + minColor: {r: 0.40085083, g: 0.254717, b: 1, a: 1} + maxColor: {r: 0.42329824, g: 0, b: 0.754717, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + startSize: + serializedVersion: 2 + minMaxState: 3 + scalar: 5.5 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSizeY: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSizeZ: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotationX: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotationY: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotation: + serializedVersion: 2 + minMaxState: 3 + scalar: 6.283185 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + randomizeRotationDirection: 0 + maxNumParticles: 1000 + size3D: 0 + rotation3D: 0 + gravityModifier: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + ShapeModule: + serializedVersion: 6 + enabled: 1 + type: 10 + angle: 25 + length: 5 + boxThickness: {x: 0, y: 0, z: 0} + radiusThickness: 1 + donutRadius: 0.2 + m_Position: {x: 0, y: 0, z: 0} + m_Rotation: {x: 0, y: 0, z: 0} + m_Scale: {x: 1, y: 1, z: 1} + placementMode: 0 + m_MeshMaterialIndex: 0 + m_MeshNormalOffset: 0 + m_MeshSpawn: + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Mesh: {fileID: 0} + m_MeshRenderer: {fileID: 0} + m_SkinnedMeshRenderer: {fileID: 0} + m_Sprite: {fileID: 0} + m_SpriteRenderer: {fileID: 0} + m_UseMeshMaterialIndex: 0 + m_UseMeshColors: 1 + alignToDirection: 0 + m_Texture: {fileID: 0} + m_TextureClipChannel: 3 + m_TextureClipThreshold: 0 + m_TextureUVChannel: 0 + m_TextureColorAffectsParticles: 1 + m_TextureAlphaAffectsParticles: 1 + m_TextureBilinearFiltering: 0 + randomDirectionAmount: 0 + sphericalDirectionAmount: 0 + randomPositionAmount: 0 + radius: + value: 0.13 + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + arc: + value: 360 + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + EmissionModule: + enabled: 1 + serializedVersion: 4 + rateOverTime: + serializedVersion: 2 + minMaxState: 0 + scalar: 10 + minScalar: 10 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + rateOverDistance: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BurstCount: 0 + m_Bursts: [] + SizeModule: + enabled: 1 + curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + RotationModule: + enabled: 1 + x: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve: + serializedVersion: 2 + minMaxState: 3 + scalar: 2.6179938 + minScalar: -2.6179938 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + ColorModule: + enabled: 1 + gradient: + serializedVersion: 2 + minMaxState: 1 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 0} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 31552 + atime2: 65535 + atime3: 65535 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 3 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + UVModule: + serializedVersion: 2 + enabled: 0 + mode: 0 + timeMode: 0 + fps: 30 + frameOverTime: + serializedVersion: 2 + minMaxState: 1 + scalar: 0.9999 + minScalar: 0.9999 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startFrame: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + speedRange: {x: 0, y: 1} + tilesX: 1 + tilesY: 1 + animationType: 0 + rowIndex: 0 + cycles: 1 + uvChannelMask: -1 + rowMode: 1 + sprites: + - sprite: {fileID: 0} + flipU: 0 + flipV: 0 + VelocityModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalX: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalY: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetX: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetY: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + radial: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + speedModifier: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + inWorldSpace: 0 + InheritVelocityModule: + enabled: 0 + m_Mode: 0 + m_Curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + ForceModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + inWorldSpace: 0 + randomizePerFrame: 0 + ExternalForcesModule: + serializedVersion: 2 + enabled: 0 + multiplierCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + influenceFilter: 0 + influenceMask: + serializedVersion: 2 + m_Bits: 4294967295 + influenceList: [] + ClampVelocityModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + magnitude: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxis: 0 + inWorldSpace: 0 + multiplyDragByParticleSize: 1 + multiplyDragByParticleVelocity: 1 + dampen: 0 + drag: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + NoiseModule: + enabled: 0 + strength: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + strengthY: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + strengthZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + frequency: 0.5 + damping: 1 + octaves: 1 + octaveMultiplier: 0.5 + octaveScale: 2 + quality: 2 + scrollSpeed: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remap: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapY: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapZ: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapEnabled: 0 + positionAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + rotationAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + sizeAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + SizeBySpeedModule: + enabled: 0 + curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + range: {x: 0, y: 1} + separateAxes: 0 + RotationBySpeedModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.7853982 + minScalar: 0.7853982 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + range: {x: 0, y: 1} + ColorBySpeedModule: + enabled: 0 + gradient: + serializedVersion: 2 + minMaxState: 1 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + range: {x: 0, y: 1} + CollisionModule: + enabled: 0 + serializedVersion: 3 + type: 0 + collisionMode: 0 + colliderForce: 0 + multiplyColliderForceByParticleSize: 0 + multiplyColliderForceByParticleSpeed: 0 + multiplyColliderForceByCollisionAngle: 1 + plane0: {fileID: 0} + plane1: {fileID: 0} + plane2: {fileID: 0} + plane3: {fileID: 0} + plane4: {fileID: 0} + plane5: {fileID: 0} + m_Dampen: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Bounce: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_EnergyLossOnCollision: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minKillSpeed: 0 + maxKillSpeed: 10000 + radiusScale: 1 + collidesWith: + serializedVersion: 2 + m_Bits: 4294967295 + maxCollisionShapes: 256 + quality: 0 + voxelSize: 0.5 + collisionMessages: 0 + collidesWithDynamic: 1 + interiorCollisions: 0 + TriggerModule: + enabled: 0 + collisionShape0: {fileID: 0} + collisionShape1: {fileID: 0} + collisionShape2: {fileID: 0} + collisionShape3: {fileID: 0} + collisionShape4: {fileID: 0} + collisionShape5: {fileID: 0} + inside: 1 + outside: 0 + enter: 0 + exit: 0 + radiusScale: 1 + SubModule: + serializedVersion: 2 + enabled: 0 + subEmitters: + - serializedVersion: 3 + emitter: {fileID: 0} + type: 0 + properties: 0 + emitProbability: 1 + LightsModule: + enabled: 0 + ratio: 0 + light: {fileID: 0} + randomDistribution: 1 + color: 1 + range: 1 + intensity: 1 + rangeCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + intensityCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + maxLights: 20 + TrailModule: + enabled: 0 + mode: 0 + ratio: 1 + lifetime: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minVertexDistance: 0.2 + textureMode: 0 + ribbonCount: 1 + shadowBias: 0.5 + worldSpace: 0 + dieWithParticles: 1 + sizeAffectsWidth: 1 + sizeAffectsLifetime: 0 + inheritParticleColor: 1 + generateLightingData: 0 + splitSubEmitterRibbons: 0 + attachRibbonsToTransform: 0 + colorOverLifetime: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + widthOverTrail: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorOverTrail: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + CustomDataModule: + enabled: 0 + mode0: 0 + vectorComponentCount0: 4 + color0: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + colorLabel0: Color + vector0_0: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_0: X + vector0_1: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_1: Y + vector0_2: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_2: Z + vector0_3: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_3: W + mode1: 0 + vectorComponentCount1: 4 + color1: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + colorLabel1: Color + vector1_0: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_0: X + vector1_1: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_1: Y + vector1_2: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_2: Z + vector1_3: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_3: W +--- !u!199 &7935039279205550812 +ParticleSystemRenderer: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279205550809} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 0} + - {fileID: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_RenderMode: 0 + m_SortMode: 3 + m_MinParticleSize: 0 + m_MaxParticleSize: 0.5 + m_CameraVelocityScale: 0 + m_VelocityScale: 0 + m_LengthScale: 2 + m_SortingFudge: 0 + m_NormalDirection: 1 + m_ShadowBias: 0 + m_RenderAlignment: 0 + m_Pivot: {x: 0, y: 0, z: 0} + m_Flip: {x: 0, y: 0, z: 0} + m_UseCustomVertexStreams: 0 + m_EnableGPUInstancing: 1 + m_ApplyActiveColorSpace: 1 + m_AllowRoll: 1 + m_VertexStreams: 00010304 + m_Mesh: {fileID: 0} + m_Mesh1: {fileID: 0} + m_Mesh2: {fileID: 0} + m_Mesh3: {fileID: 0} + m_MaskInteraction: 0 +--- !u!114 &7935039279205550811 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279205550809} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee158225ee1e59f4791627785501d950, type: 3} + m_Name: + m_EditorClassIdentifier: + shaderTypes: 0 + normalStrength: 5 + normalSmoothing: 1 + computingNormal: 0 +--- !u!1 &7935039279796415621 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7935039279796415622} + - component: {fileID: 7935039279796415672} + - component: {fileID: 7935039279796415623} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &7935039279796415622 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279796415621} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.57, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7935039278937507618} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &7935039279796415672 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279796415621} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!102 &7935039279796415623 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7935039279796415621} + m_Text: (Has Animation) + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab.meta new file mode 100644 index 00000000..58655060 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 161eac4f3ec2ef344ae473e275658ecf +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Particle System Demo.prefab + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab new file mode 100644 index 00000000..ba7cbad0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab @@ -0,0 +1,5267 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3864259598328230473 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3864259598328230474} + - component: {fileID: 3864259598328230476} + - component: {fileID: 3864259598328230475} + m_Layer: 0 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3864259598328230474 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259598328230473} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -3.1267126, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 3864259599682641153} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &3864259598328230476 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259598328230473} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!102 &3864259598328230475 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259598328230473} + m_Text: Shield Soldier + m_OffsetZ: -1.5 + m_CharacterSize: 0.075 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!1 &3864259598540621426 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3864259598540621427} + - component: {fileID: 3864259598540621429} + - component: {fileID: 3864259598540621428} + m_Layer: 0 + m_Name: Animated + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3864259598540621427 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259598540621426} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -4.447157, z: 0} + m_LocalScale: {x: 1.2457023, y: 1.2457023, z: 1.2457023} + m_Children: [] + m_Father: {fileID: 3864259599682641153} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &3864259598540621429 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259598540621426} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!102 &3864259598540621428 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259598540621426} + m_Text: (Sprite Mask and Particles) + m_OffsetZ: -1.5 + m_CharacterSize: 0.05 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 0 + m_TabSize: 4 + m_FontSize: 100 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 12800000, guid: a4e6a5491519adb45919dc87eff28e55, type: 3} + m_Color: + serializedVersion: 2 + rgba: 4294967295 +--- !u!1 &3864259599192371921 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3864259599192371922} + - component: {fileID: 3864259599192371923} + m_Layer: 0 + m_Name: Shield + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3864259599192371922 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599192371921} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.0582, y: 0.0478, z: -0.1} + m_LocalScale: {x: 1.3402556, y: 1.4230473, z: 1} + m_Children: [] + m_Father: {fileID: 3864259599682641153} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &3864259599192371923 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599192371921} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 4396a2d1265c9414e810fdf77d8238b5, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 2f5c9cbfde2d0384bb53189b0d0f06d8, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 1 + m_SpriteSortPoint: 0 +--- !u!1 &3864259599213150330 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3864259599213150331} + - component: {fileID: 3864259599213150333} + - component: {fileID: 3864259599213150332} + m_Layer: 0 + m_Name: ShieldSparksPS + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3864259599213150331 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599213150330} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.058, y: 0.038, z: -0.1} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 3864259599682641153} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} +--- !u!198 &3864259599213150333 +ParticleSystem: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599213150330} + serializedVersion: 6 + lengthInSec: 1 + simulationSpeed: 1 + stopAction: 0 + cullingMode: 0 + ringBufferMode: 0 + ringBufferLoopRange: {x: 0, y: 1} + looping: 1 + prewarm: 0 + playOnAwake: 1 + useUnscaledTime: 0 + autoRandomSeed: 1 + useRigidbodyForVelocity: 1 + startDelay: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + moveWithTransform: 1 + moveWithCustomTransform: {fileID: 0} + scalingMode: 1 + randomSeed: 0 + InitialModule: + serializedVersion: 3 + enabled: 1 + startLifetime: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.75 + minScalar: 5 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSpeed: + serializedVersion: 2 + minMaxState: 3 + scalar: 0.2 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startColor: + serializedVersion: 2 + minMaxState: 2 + minColor: {r: 0.009433985, g: 1, b: 0.9403363, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + startSize: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 0.1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSizeY: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startSizeZ: + serializedVersion: 2 + minMaxState: 3 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotationX: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotationY: + serializedVersion: 2 + minMaxState: 3 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startRotation: + serializedVersion: 2 + minMaxState: 3 + scalar: 6.283185 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + randomizeRotationDirection: 0 + maxNumParticles: 1000 + size3D: 0 + rotation3D: 0 + gravityModifier: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + ShapeModule: + serializedVersion: 6 + enabled: 1 + type: 12 + angle: 25 + length: 5 + boxThickness: {x: 0, y: 0, z: 0} + radiusThickness: 1 + donutRadius: 0.2 + m_Position: {x: 0, y: 0, z: 0} + m_Rotation: {x: 0, y: 0, z: 0} + m_Scale: {x: 1, y: 1, z: 1} + placementMode: 0 + m_MeshMaterialIndex: 0 + m_MeshNormalOffset: 0 + m_MeshSpawn: + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Mesh: {fileID: 0} + m_MeshRenderer: {fileID: 0} + m_SkinnedMeshRenderer: {fileID: 0} + m_Sprite: {fileID: 0} + m_SpriteRenderer: {fileID: 0} + m_UseMeshMaterialIndex: 0 + m_UseMeshColors: 1 + alignToDirection: 0 + m_Texture: {fileID: 0} + m_TextureClipChannel: 3 + m_TextureClipThreshold: 0 + m_TextureUVChannel: 0 + m_TextureColorAffectsParticles: 1 + m_TextureAlphaAffectsParticles: 1 + m_TextureBilinearFiltering: 0 + randomDirectionAmount: 0 + sphericalDirectionAmount: 0 + randomPositionAmount: 0 + radius: + value: 1.23 + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + arc: + value: 360 + mode: 0 + spread: 0 + speed: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + EmissionModule: + enabled: 1 + serializedVersion: 4 + rateOverTime: + serializedVersion: 2 + minMaxState: 0 + scalar: 30 + minScalar: 10 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + rateOverDistance: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BurstCount: 1 + m_Bursts: + - serializedVersion: 2 + time: 0 + countCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 30 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + cycleCount: 1 + repeatInterval: 0.01 + probability: 1 + SizeModule: + enabled: 1 + curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 15.478566 + outSlope: 15.478566 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.061415076 + value: 0.9506173 + inSlope: 0.28985757 + outSlope: 0.28985757 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.24300326 + - serializedVersion: 3 + time: 0.6683 + value: 0.8456783 + inSlope: -1.3612208 + outSlope: -1.3612208 + tangentMode: 34 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: -2.5495274 + outSlope: -2.5495274 + tangentMode: 34 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + RotationModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.7853982 + minScalar: 0.7853982 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + ColorModule: + enabled: 1 + gradient: + serializedVersion: 2 + minMaxState: 1 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 23708 + atime2: 65535 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 3 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + UVModule: + serializedVersion: 2 + enabled: 0 + mode: 0 + timeMode: 0 + fps: 30 + frameOverTime: + serializedVersion: 2 + minMaxState: 1 + scalar: 0.9999 + minScalar: 0.9999 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + startFrame: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + speedRange: {x: 0, y: 1} + tilesX: 1 + tilesY: 1 + animationType: 0 + rowIndex: 0 + cycles: 1 + uvChannelMask: -1 + rowMode: 1 + sprites: + - sprite: {fileID: 0} + flipU: 0 + flipV: 0 + VelocityModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalX: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalY: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetX: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetY: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + orbitalOffsetZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + radial: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + speedModifier: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + inWorldSpace: 0 + InheritVelocityModule: + enabled: 0 + m_Mode: 0 + m_Curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + ForceModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + inWorldSpace: 0 + randomizePerFrame: 0 + ExternalForcesModule: + serializedVersion: 2 + enabled: 0 + multiplierCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + influenceFilter: 0 + influenceMask: + serializedVersion: 2 + m_Bits: 4294967295 + influenceList: [] + ClampVelocityModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + magnitude: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxis: 0 + inWorldSpace: 0 + multiplyDragByParticleSize: 1 + multiplyDragByParticleVelocity: 1 + dampen: 0 + drag: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + NoiseModule: + enabled: 0 + strength: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + strengthY: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + strengthZ: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + frequency: 0.5 + damping: 1 + octaves: 1 + octaveMultiplier: 0.5 + octaveScale: 2 + quality: 2 + scrollSpeed: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remap: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapY: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapZ: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + remapEnabled: 0 + positionAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + rotationAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + sizeAmount: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + SizeBySpeedModule: + enabled: 0 + curve: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + z: + serializedVersion: 2 + minMaxState: 1 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + range: {x: 0, y: 1} + separateAxes: 0 + RotationBySpeedModule: + enabled: 0 + x: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + y: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve: + serializedVersion: 2 + minMaxState: 0 + scalar: 0.7853982 + minScalar: 0.7853982 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + separateAxes: 0 + range: {x: 0, y: 1} + ColorBySpeedModule: + enabled: 0 + gradient: + serializedVersion: 2 + minMaxState: 1 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + range: {x: 0, y: 1} + CollisionModule: + enabled: 0 + serializedVersion: 3 + type: 0 + collisionMode: 0 + colliderForce: 0 + multiplyColliderForceByParticleSize: 0 + multiplyColliderForceByParticleSpeed: 0 + multiplyColliderForceByCollisionAngle: 1 + plane0: {fileID: 0} + plane1: {fileID: 0} + plane2: {fileID: 0} + plane3: {fileID: 0} + plane4: {fileID: 0} + plane5: {fileID: 0} + m_Dampen: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_Bounce: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_EnergyLossOnCollision: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minKillSpeed: 0 + maxKillSpeed: 10000 + radiusScale: 1 + collidesWith: + serializedVersion: 2 + m_Bits: 4294967295 + maxCollisionShapes: 256 + quality: 0 + voxelSize: 0.5 + collisionMessages: 0 + collidesWithDynamic: 1 + interiorCollisions: 0 + TriggerModule: + enabled: 0 + collisionShape0: {fileID: 0} + collisionShape1: {fileID: 0} + collisionShape2: {fileID: 0} + collisionShape3: {fileID: 0} + collisionShape4: {fileID: 0} + collisionShape5: {fileID: 0} + inside: 1 + outside: 0 + enter: 0 + exit: 0 + radiusScale: 1 + SubModule: + serializedVersion: 2 + enabled: 0 + subEmitters: + - serializedVersion: 3 + emitter: {fileID: 0} + type: 0 + properties: 0 + emitProbability: 1 + LightsModule: + enabled: 0 + ratio: 0 + light: {fileID: 0} + randomDistribution: 1 + color: 1 + range: 1 + intensity: 1 + rangeCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + intensityCurve: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + maxLights: 20 + TrailModule: + enabled: 0 + mode: 0 + ratio: 1 + lifetime: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minVertexDistance: 0.2 + textureMode: 0 + ribbonCount: 1 + shadowBias: 0.5 + worldSpace: 0 + dieWithParticles: 1 + sizeAffectsWidth: 1 + sizeAffectsLifetime: 0 + inheritParticleColor: 1 + generateLightingData: 0 + splitSubEmitterRibbons: 0 + attachRibbonsToTransform: 0 + colorOverLifetime: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + widthOverTrail: + serializedVersion: 2 + minMaxState: 0 + scalar: 1 + minScalar: 1 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorOverTrail: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + CustomDataModule: + enabled: 0 + mode0: 0 + vectorComponentCount0: 4 + color0: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + colorLabel0: Color + vector0_0: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_0: X + vector0_1: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_1: Y + vector0_2: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_2: Z + vector0_3: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel0_3: W + mode1: 0 + vectorComponentCount1: 4 + color1: + serializedVersion: 2 + minMaxState: 0 + minColor: {r: 1, g: 1, b: 1, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 1} + maxGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + minGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + colorLabel1: Color + vector1_0: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_0: X + vector1_1: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_1: Y + vector1_2: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_2: Z + vector1_3: + serializedVersion: 2 + minMaxState: 0 + scalar: 0 + minScalar: 0 + maxCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + minCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + vectorLabel1_3: W +--- !u!199 &3864259599213150332 +ParticleSystemRenderer: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599213150330} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: e2fd28a60d223ba4cb25e286da19b13a, type: 2} + - {fileID: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_RenderMode: 0 + m_SortMode: 0 + m_MinParticleSize: 0 + m_MaxParticleSize: 0.5 + m_CameraVelocityScale: 0 + m_VelocityScale: 0 + m_LengthScale: 2 + m_SortingFudge: 0 + m_NormalDirection: 1 + m_ShadowBias: 0 + m_RenderAlignment: 0 + m_Pivot: {x: 0, y: 0, z: 0} + m_Flip: {x: 0, y: 0, z: 0} + m_UseCustomVertexStreams: 0 + m_EnableGPUInstancing: 1 + m_ApplyActiveColorSpace: 1 + m_AllowRoll: 1 + m_VertexStreams: 00010304 + m_Mesh: {fileID: 0} + m_Mesh1: {fileID: 0} + m_Mesh2: {fileID: 0} + m_Mesh3: {fileID: 0} + m_MaskInteraction: 0 +--- !u!1 &3864259599682641152 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3864259599682641153} + - component: {fileID: 3864259599682641158} + - component: {fileID: 3864259599682641157} + - component: {fileID: 3864259599682641155} + - component: {fileID: 3864259599682641154} + m_Layer: 0 + m_Name: Shield Soldier Demo + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3864259599682641153 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599682641152} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 360, y: 0, z: 0} + m_LocalScale: {x: 0.80276, y: 0.80276, z: 0.80276} + m_Children: + - {fileID: 3864259599192371922} + - {fileID: 3864259599213150331} + - {fileID: 3864259598328230474} + - {fileID: 3864259598540621427} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &3864259599682641158 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599682641152} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 8a80b25e622f6c84aac445df7e206085, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 5.12, y: 5.12} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &3864259599682641157 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599682641152} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98b644315d7a92842b89e04f55c48e02, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!331 &3864259599682641155 +SpriteMask: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599682641152} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10758, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 519dafacd208bb64c83d5124be03b09d, type: 3} + m_MaskAlphaCutoff: 0.2 + m_FrontSortingLayerID: 0 + m_BackSortingLayerID: 0 + m_FrontSortingLayer: 0 + m_BackSortingLayer: 0 + m_FrontSortingOrder: 0 + m_BackSortingOrder: 0 + m_IsCustomRangeActive: 0 + m_SpriteSortPoint: 0 +--- !u!95 &3864259599682641154 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864259599682641152} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 48122208e82681f45a0f7dda84aa301f, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab.meta new file mode 100644 index 00000000..ab4790db --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 11bf72cfca6ba93459ddeacea51fd0bd +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Prefabs/Shield Soldier Demo.prefab + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts.meta new file mode 100644 index 00000000..e9a26c4b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d00a14e1119cac04092102f8e78ad652 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs new file mode 100644 index 00000000..7de65d62 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs @@ -0,0 +1,186 @@ +using UnityEngine; +using UnityEngine.EventSystems; +using UnityEngine.Rendering; +using UnityEngine.UI; + +#if ENABLE_INPUT_SYSTEM +using UnityEngine.InputSystem.UI; +#endif + +namespace AllIn1SpriteShader +{ + public class All1ShaderDemoController : MonoBehaviour + { + [SerializeField] private DemoCircleExpositor[] expositors = null; + [SerializeField] private Text expositorsTitle = null, expositorsTitleOutline = null; + public float expositorDistance; + + private int currExpositor; + + [SerializeField] private GameObject background = null; + private Material backgroundMat; + [SerializeField] private float colorLerpSpeed = 0; + private Color[] targetColors; + private Color[] currentColors; + + private EventSystem eventSystem; + + // Custom sort axis fields + private Camera mainCamera; + private TransparencySortMode originalSortMode; + private Vector3 originalSortAxis; + private bool sortingWasModified = false; + + void Start() + { + EventSystem eventSystemInScene = GameObject.FindAnyObjectByType(); + if (eventSystemInScene != null) + { + GameObject.Destroy(eventSystemInScene.gameObject); + } + + GameObject goEventSystem = new GameObject("Event System"); + eventSystem = goEventSystem.AddComponent(); + +#if ENABLE_INPUT_SYSTEM + goEventSystem.AddComponent(); +#elif ENABLE_LEGACY_INPUT_MANAGER + goEventSystem.AddComponent(); +#endif + + // Setup custom sort axis + SetupCustomSortAxis(); + + currExpositor = 0; + SetExpositorText(); + + for (int i = 0; i < expositors.Length; i++) expositors[i].transform.position = new Vector3(0, expositorDistance * i, 0); + + backgroundMat = background.GetComponent().material; + targetColors = new Color[4]; + targetColors[0] = backgroundMat.GetColor("_GradTopLeftCol"); + targetColors[1] = backgroundMat.GetColor("_GradTopRightCol"); + targetColors[2] = backgroundMat.GetColor("_GradBotLeftCol"); + targetColors[3] = backgroundMat.GetColor("_GradBotRightCol"); + currentColors = targetColors.Clone() as Color[]; + } + + void Update() + { + GetInput(); + + currentColors[0] = Color.Lerp(currentColors[0], targetColors[(0 + currExpositor) % targetColors.Length], colorLerpSpeed * Time.deltaTime); + currentColors[1] = Color.Lerp(currentColors[1], targetColors[(1 + currExpositor) % targetColors.Length], colorLerpSpeed * Time.deltaTime); + currentColors[2] = Color.Lerp(currentColors[2], targetColors[(2 + currExpositor) % targetColors.Length], colorLerpSpeed * Time.deltaTime); + currentColors[3] = Color.Lerp(currentColors[3], targetColors[(3 + currExpositor) % targetColors.Length], colorLerpSpeed * Time.deltaTime); + backgroundMat.SetColor("_GradTopLeftCol", currentColors[0]); + backgroundMat.SetColor("_GradTopRightCol", currentColors[1]); + backgroundMat.SetColor("_GradBotLeftCol", currentColors[2]); + backgroundMat.SetColor("_GradBotRightCol", currentColors[3]); + } + + private void GetInput() + { + if (AllIn1InputSystem.GetKeyDown(KeyCode.LeftArrow) || AllIn1InputSystem.GetKeyDown(KeyCode.A)) + { + expositors[currExpositor].ChangeTarget(-1); + } + else if (AllIn1InputSystem.GetKeyDown(KeyCode.RightArrow) || AllIn1InputSystem.GetKeyDown(KeyCode.D)) + { + expositors[currExpositor].ChangeTarget(1); + } + else if (AllIn1InputSystem.GetKeyDown(KeyCode.UpArrow) || AllIn1InputSystem.GetKeyDown(KeyCode.W)) + { + ChangeExpositor(-1); + } + else if (AllIn1InputSystem.GetKeyDown(KeyCode.DownArrow) || AllIn1InputSystem.GetKeyDown(KeyCode.S)) + { + ChangeExpositor(1); + } + } + + private void ChangeExpositor(int offset) + { + currExpositor += offset; + if (currExpositor > expositors.Length - 1) currExpositor = 0; + else if (currExpositor < 0) currExpositor = expositors.Length - 1; + SetExpositorText(); + } + + private void SetExpositorText() + { + expositorsTitle.text = expositors[currExpositor].name; + expositorsTitleOutline.text = expositors[currExpositor].name; + } + + public int GetCurrExpositor() { return currExpositor; } + + private void SetupCustomSortAxis() + { + mainCamera = Camera.main; + if (mainCamera == null) + { + Debug.LogWarning("All1ShaderDemoController: Main camera not found. Custom sort axis will not be applied."); + return; + } + + // Save original settings + originalSortMode = mainCamera.transparencySortMode; + originalSortAxis = mainCamera.transparencySortAxis; + + // Detect render pipeline + string pipelineType = GetRenderPipelineType(); + + try + { + // Apply custom sort axis for all pipelines + // This is a Camera property that works across all render pipelines + mainCamera.transparencySortMode = TransparencySortMode.CustomAxis; + mainCamera.transparencySortAxis = new Vector3(0, 0, 1); + sortingWasModified = true; + + //Debug.Log($"All1ShaderDemoController: Custom sort axis applied successfully ({mainCamera.transparencySortAxis}) for {pipelineType}"); + } + catch (System.Exception e) + { + Debug.LogWarning($"All1ShaderDemoController: Failed to apply custom sort axis for {pipelineType}. Error: {e.Message}"); + sortingWasModified = false; + } + } + + private string GetRenderPipelineType() + { + RenderPipelineAsset currentRP = UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline; + + if (currentRP == null) + { + return "Built-in Render Pipeline"; + } + + string rpTypeName = currentRP.GetType().Name; + + if (rpTypeName.Contains("Universal") || rpTypeName.Contains("URP")) + { + return "Universal Render Pipeline (URP)"; + } + else if (rpTypeName.Contains("HD") || rpTypeName.Contains("HighDefinition")) + { + return "High Definition Render Pipeline (HDRP)"; + } + else + { + return $"Custom SRP ({rpTypeName})"; + } + } + + private void OnDestroy() + { + // Restore original camera settings + if (sortingWasModified && mainCamera != null) + { + mainCamera.transparencySortMode = originalSortMode; + mainCamera.transparencySortAxis = originalSortAxis; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs.meta new file mode 100644 index 00000000..698f3700 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: b549ed925b49d274c876184f60faabdf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1ShaderDemoController.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs new file mode 100644 index 00000000..61138c11 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs @@ -0,0 +1,57 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +namespace AllIn1SpriteShader +{ + public class All1TextureOffsetOverTime : MonoBehaviour + { + [SerializeField] private string texturePropertyName = "_MainTex"; + [SerializeField] private Vector2 offsetSpeed = Vector2.zero; + + [SerializeField, Header("If missing will search object Sprite Renderer or UI Image")] + private Material mat; + + private int textureShaderId; + private Vector2 currOffset = Vector2.zero; + + private void Start() + { + //Get material if missing + if (mat == null) + { + SpriteRenderer sr = GetComponent(); + if (sr != null) mat = sr.material; + else + { + Image i = GetComponent(); + if (i != null) mat = i.material; + } + } + + //Show error message if material or textureName property error + //Otherwise cache shader property ID + if (mat == null) DestroyComponentAndLogError(gameObject.name + " has no valid Material, deleting All1TextureOffsetOverTIme component"); + else + { + if (mat.HasProperty(texturePropertyName)) textureShaderId = Shader.PropertyToID(texturePropertyName); + else DestroyComponentAndLogError(gameObject.name + "'s Material doesn't have a " + texturePropertyName + " property"); + } + } + + public void Update() + { + //Update currOffset and update shader property + currOffset.x += offsetSpeed.x * Time.deltaTime; + currOffset.y += offsetSpeed.y * Time.deltaTime; + mat.SetTextureOffset(textureShaderId, currOffset); + } + + private void DestroyComponentAndLogError(string logError) + { + Debug.LogError(logError); + Destroy(this); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs.meta new file mode 100644 index 00000000..a64a9cc5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: f3804424ee2f162418d9294faf7ba055 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/All1TextureOffsetOverTIme.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs new file mode 100644 index 00000000..a231d85d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace AllIn1SpriteShader.Demo.Scripts +{ + public class AllIn1AutoRotate : MonoBehaviour + { + [SerializeField] private float rotationSpeed = 30f; + [SerializeField] private Vector3 rotationAxis = Vector3.up; + [SerializeField] private bool useLocalRotation; + + private void Update() + { + transform.Rotate(rotationAxis * (rotationSpeed * Time.deltaTime), useLocalRotation ? Space.Self : Space.World); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs.meta new file mode 100644 index 00000000..a2a23694 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: f2560c72fbbcfe44195e240286d1d4e5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1AutoRotate.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1InputSystem.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1InputSystem.cs new file mode 100644 index 00000000..384aa352 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1InputSystem.cs @@ -0,0 +1,80 @@ +using UnityEngine; +#if ENABLE_INPUT_SYSTEM +using UnityEngine.InputSystem; +#endif + +namespace AllIn1SpriteShader +{ + public static class AllIn1InputSystem + { +#if ENABLE_INPUT_SYSTEM + public static bool GetKeyDown(KeyCode keyCode) + { + Key key = InputKeyConverter.GetKeyFromKeycode(keyCode); + + bool res = Keyboard.current[key].wasPressedThisFrame; + return res; + } + + public static bool GetKey(KeyCode keyCode) + { + Key key = InputKeyConverter.GetKeyFromKeycode(keyCode); + bool res = Keyboard.current[key].isPressed; + return res; + } + + public static float GetMouseXAxis() + { + Vector2 delta = Mouse.current.delta.ReadValue(); + float res = delta.x * 0.1f; + return res; + } + + public static float GetMouseYAxis() + { + Vector2 delta = Mouse.current.delta.ReadValue(); + float res = delta.y * 0.1f; + return res; + } + + public static float GetMouseScroll() + { + Vector2 scrollValue = Mouse.current.scroll.ReadValue(); + + float res = scrollValue.y * 0.1f; + return res; + } + +#elif ENABLE_LEGACY_INPUT_MANAGER + public static bool GetKeyDown(KeyCode keyCode) + { + bool res = Input.GetKeyDown(keyCode); + return res; + } + + public static bool GetKey(KeyCode keyCode) + { + bool res = Input.GetKey(keyCode); + return res; + } + + public static float GetMouseXAxis() + { + float res = Input.GetAxis("Mouse X"); + return res; + } + + public static float GetMouseYAxis() + { + float res = Input.GetAxis("Mouse Y"); + return res; + } + + public static float GetMouseScroll() + { + float res = Input.GetAxis("Mouse ScrollWheel"); + return res; + } +#endif + } +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1InputSystem.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1InputSystem.cs.meta new file mode 100644 index 00000000..f4c5f835 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1InputSystem.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 3c82e579907176d47a26bd6ed1d1457f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1InputSystem.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs new file mode 100644 index 00000000..d98f8e7f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs @@ -0,0 +1,62 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +namespace AllIn1SpriteShader +{ + public class AllIn1ScrollProperty : MonoBehaviour + { + [SerializeField] private string numericPropertyName = "_RotateUvAmount"; + [SerializeField] private float scrollSpeed = 0f; + + [Space, SerializeField] private bool applyModulo = false; + [SerializeField] private float modulo = 1f; + + [Space, SerializeField, Header("If missing will search object Sprite Renderer or UI Image")] + private Material mat; + + private int propertyShaderID; + private float currValue; + + public void Start() + { + //Get material if missing + if (mat == null) + { + SpriteRenderer sr = GetComponent(); + if (sr != null) mat = sr.material; + else + { + Image i = GetComponent(); + if (i != null) mat = i.material; + } + } + + //Show error message if material or numericPropertyName property error + //Otherwise cache shader property ID + if (mat == null) DestroyComponentAndLogError(gameObject.name + " has no valid Material, deleting All1TextureOffsetOverTIme component"); + else + { + if (mat.HasProperty(numericPropertyName)) propertyShaderID = Shader.PropertyToID(numericPropertyName); + else DestroyComponentAndLogError(gameObject.name + "'s Material doesn't have a " + numericPropertyName + " property"); + + currValue = mat.GetFloat(propertyShaderID); + } + } + + private void Update() + { + //Update currOffset and update shader property + currValue += scrollSpeed * Time.deltaTime; + if (applyModulo) currValue %= modulo; + mat.SetFloat(propertyShaderID, currValue); + } + + private void DestroyComponentAndLogError(string logError) + { + Debug.LogError(logError); + Destroy(this); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs.meta new file mode 100644 index 00000000..38b3869c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 384dba07353e1f242b467b6857a1e3d4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/AllIn1ScrollProperty.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs new file mode 100644 index 00000000..165b5f64 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs @@ -0,0 +1,49 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class Demo2AutoScroll : MonoBehaviour + { + private Transform[] children; + public float totalTime; + public GameObject sceneDescription = null; + + void Start() + { + sceneDescription.SetActive(false); + Camera.main.fieldOfView = 60f; + children = GetComponentsInChildren(); + for (int i = 0; i < children.Length; i++) + { + if (children[i].gameObject != gameObject) + { + children[i].gameObject.SetActive(false); + children[i].localPosition = Vector3.zero; + } + } + + totalTime = totalTime / (float)children.Length; + + StartCoroutine(ScrollElements()); + } + + IEnumerator ScrollElements() + { + int i = 0; + while (true) + { + if (children[i].gameObject == gameObject) + { + i = (i + 1) % children.Length; + continue; + } + children[i].gameObject.SetActive(true); + yield return new WaitForSeconds(totalTime); + children[i].gameObject.SetActive(false); + i = (i + 1) % children.Length; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs.meta new file mode 100644 index 00000000..be127ed1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: cc188be2d64e8d041aed6f375d92c463 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/Demo2AutoScroll.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs new file mode 100644 index 00000000..9d9b354d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections; +using System.Reflection; +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class DemoCamera : MonoBehaviour + { + [SerializeField] private Transform targetedItem = null; + [SerializeField] private All1ShaderDemoController demoController = null; + [SerializeField] private float speed = 0; + private Vector3 offset; + private Vector3 target; + private bool canUpdate = false; + + private void Awake() + { + EnablePostProcessingForURP(); + offset = transform.position - targetedItem.position; + StartCoroutine(SetCamAfterStart()); + } + + private void EnablePostProcessingForURP() + { + #if UNITY_2019_3_OR_NEWER + try + { + Type urpCameraDataType = Type.GetType("UnityEngine.Rendering.Universal.UniversalAdditionalCameraData, Unity.RenderPipelines.Universal.Runtime"); + if (urpCameraDataType == null) + { + return; + } + + Camera cam = GetComponent(); + if (cam == null) + { + Debug.LogWarning("[DemoCamera] No Camera component found on GameObject", this); + return; + } + + Component urpCameraData = cam.GetComponent(urpCameraDataType); + if (urpCameraData == null) + { + urpCameraData = cam.gameObject.AddComponent(urpCameraDataType); + Debug.Log("[DemoCamera] Added UniversalAdditionalCameraData component for URP post processing", this); + } + + PropertyInfo renderPostProcessingProperty = urpCameraDataType.GetProperty("renderPostProcessing"); + if (renderPostProcessingProperty != null && renderPostProcessingProperty.CanWrite) + { + bool currentValue = (bool)renderPostProcessingProperty.GetValue(urpCameraData); + if (!currentValue) + { + renderPostProcessingProperty.SetValue(urpCameraData, true); + Debug.Log("[DemoCamera] Enabled URP post processing on camera", this); + } + } + else + { + Debug.LogWarning("[DemoCamera] Could not find or access 'renderPostProcessing' property. URP version might not support this feature.", this); + } + } + catch (Exception e) + { + Debug.LogWarning($"[DemoCamera] Failed to enable URP post processing: {e.Message}", this); + } + #endif + } + + private void Update() + { + if (!canUpdate) return; + target.y = demoController.GetCurrExpositor() * demoController.expositorDistance; + transform.position = Vector3.Lerp(transform.position, target, speed * Time.deltaTime); + } + + private IEnumerator SetCamAfterStart() + { + yield return null; + transform.position = targetedItem.position + offset; + target = transform.position; + canUpdate = true; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs.meta new file mode 100644 index 00000000..3116bda5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: fcb2e887baa071545bad04c7b0e87cce +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCamera.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs new file mode 100644 index 00000000..3fa399f6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs @@ -0,0 +1,54 @@ +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class DemoCircleExpositor : MonoBehaviour + { + [SerializeField] private float radius = 40f; + [SerializeField] private float rotateSpeed = 10f; + + private float zOffset = 0f; + private Transform[] items; + private int count = 0; + private int currentTarget = 0; + private float offsetRotation, iniY; + private Quaternion dummyRotation; + + void Start() + { + dummyRotation = transform.rotation; + iniY = transform.position.y; + + items = new Transform[transform.childCount]; + foreach (Transform child in transform) + { + items[count] = child; + count++; + } + + offsetRotation = 360.0f / count; + for (int i = 0; i < count; i++) + { + float angle = i * Mathf.PI * 2f / count; + Vector3 newPos = new Vector3(Mathf.Sin(angle) * radius, iniY, -Mathf.Cos(angle) * radius); + items[i].position = newPos; + } + + zOffset = radius - 40f; + transform.position = new Vector3(transform.position.x, transform.position.y, zOffset); + } + + private void Update() + { + transform.rotation = Quaternion.Slerp(transform.rotation, dummyRotation, rotateSpeed * Time.deltaTime); + } + + public void ChangeTarget(int offset) + { + currentTarget += offset; + if (currentTarget > items.Length - 1) currentTarget = 0; + else if (currentTarget < 0) currentTarget = items.Length - 1; + dummyRotation *= Quaternion.Euler(Vector3.up * (offset * offsetRotation)); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs.meta new file mode 100644 index 00000000..46e9866f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 6972382efdee4c642812251660f0c4bb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoCircleExpositor.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs new file mode 100644 index 00000000..95a88bfe --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class DemoItem : MonoBehaviour + { + static readonly Vector3 lookAtZ = new Vector3(0, 0, 1); + + void Update() + { + transform.LookAt(transform.position + lookAtZ); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs.meta new file mode 100644 index 00000000..e7f62c4b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 98b644315d7a92842b89e04f55c48e02 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoItem.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs new file mode 100644 index 00000000..afa8d7b2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class DemoRandomColorSwap : MonoBehaviour + { + private Material mat; + private readonly int colorSwapRed = Shader.PropertyToID("_ColorSwapRed"); + private readonly int colorSwapGreen = Shader.PropertyToID("_ColorSwapGreen"); + private readonly int colorSwapBlue = Shader.PropertyToID("_ColorSwapBlue"); + + void Start() + { + SpriteRenderer sr = GetComponent(); + if (sr != null) + { + mat = GetComponent().material; + if (mat != null) InvokeRepeating(nameof(NewColor), 0.0f, 0.6f); + else + { + Debug.LogError("No material found"); + Destroy(this); + } + } + } + + private void NewColor() + { + mat.SetColor(colorSwapRed, GenerateColor()); + mat.SetColor(colorSwapGreen, GenerateColor()); + mat.SetColor(colorSwapBlue, GenerateColor()); + } + + private Color GenerateColor() + { + return new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1f); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs.meta new file mode 100644 index 00000000..f68d7e9b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 4ef3964599ee48c4ea5a4ecf012ed949 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRandomColorSwap.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs new file mode 100644 index 00000000..b26becf8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs @@ -0,0 +1,24 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class DemoRepositionExpositor : MonoBehaviour + { + [SerializeField] private float paddingX = 10f; + + [ContextMenu("RepositionExpositor")] + private void RepositionExpositor() + { + int i = 0; + Vector3 tempLocalPos = Vector3.zero; + foreach (Transform child in transform) + { + tempLocalPos.x = i * paddingX; + child.localPosition = tempLocalPos; + i++; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs.meta new file mode 100644 index 00000000..f50abffe --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 681095680e77fad40a6dd907b8ba358b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/DemoRepositionExpositor.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/InputKeyConverter.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/InputKeyConverter.cs new file mode 100644 index 00000000..49af3b40 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/InputKeyConverter.cs @@ -0,0 +1,331 @@ +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public static class InputKeyConverter + { +#if ENABLE_INPUT_SYSTEM + public static UnityEngine.InputSystem.Key GetKeyFromKeycode(KeyCode keyCode) + { + UnityEngine.InputSystem.Key res = UnityEngine.InputSystem.Key.Space; + switch (keyCode) + { + case KeyCode.A: + res = UnityEngine.InputSystem.Key.A; + break; + case KeyCode.B: + res = UnityEngine.InputSystem.Key.B; + break; + case KeyCode.C: + res = UnityEngine.InputSystem.Key.C; + break; + case KeyCode.D: + res = UnityEngine.InputSystem.Key.D; + break; + case KeyCode.E: + res = UnityEngine.InputSystem.Key.E; + break; + case KeyCode.F: + res = UnityEngine.InputSystem.Key.F; + break; + case KeyCode.G: + res = UnityEngine.InputSystem.Key.G; + break; + case KeyCode.H: + res = UnityEngine.InputSystem.Key.H; + break; + case KeyCode.I: + res = UnityEngine.InputSystem.Key.I; + break; + case KeyCode.J: + res = UnityEngine.InputSystem.Key.J; + break; + case KeyCode.K: + res = UnityEngine.InputSystem.Key.K; + break; + case KeyCode.L: + res = UnityEngine.InputSystem.Key.L; + break; + case KeyCode.M: + res = UnityEngine.InputSystem.Key.M; + break; + case KeyCode.N: + res = UnityEngine.InputSystem.Key.N; + break; + case KeyCode.O: + res = UnityEngine.InputSystem.Key.O; + break; + case KeyCode.P: + res = UnityEngine.InputSystem.Key.P; + break; + case KeyCode.Q: + res = UnityEngine.InputSystem.Key.Q; + break; + case KeyCode.R: + res = UnityEngine.InputSystem.Key.R; + break; + case KeyCode.S: + res = UnityEngine.InputSystem.Key.S; + break; + case KeyCode.T: + res = UnityEngine.InputSystem.Key.T; + break; + case KeyCode.U: + res = UnityEngine.InputSystem.Key.U; + break; + case KeyCode.V: + res = UnityEngine.InputSystem.Key.V; + break; + case KeyCode.W: + res = UnityEngine.InputSystem.Key.W; + break; + case KeyCode.X: + res = UnityEngine.InputSystem.Key.X; + break; + case KeyCode.Y: + res = UnityEngine.InputSystem.Key.Y; + break; + case KeyCode.Z: + res = UnityEngine.InputSystem.Key.Z; + break; + case KeyCode.Alpha0: + res = UnityEngine.InputSystem.Key.Digit0; + break; + case KeyCode.Alpha1: + res = UnityEngine.InputSystem.Key.Digit1; + break; + case KeyCode.Alpha2: + res = UnityEngine.InputSystem.Key.Digit2; + break; + case KeyCode.Alpha3: + res = UnityEngine.InputSystem.Key.Digit3; + break; + case KeyCode.Alpha4: + res = UnityEngine.InputSystem.Key.Digit4; + break; + case KeyCode.Alpha5: + res = UnityEngine.InputSystem.Key.Digit5; + break; + case KeyCode.Alpha6: + res = UnityEngine.InputSystem.Key.Digit6; + break; + case KeyCode.Alpha7: + res = UnityEngine.InputSystem.Key.Digit7; + break; + case KeyCode.Alpha8: + res = UnityEngine.InputSystem.Key.Digit8; + break; + case KeyCode.Alpha9: + res = UnityEngine.InputSystem.Key.Digit9; + break; + case KeyCode.Space: + res = UnityEngine.InputSystem.Key.Space; + break; + case KeyCode.Return: + res = UnityEngine.InputSystem.Key.Enter; + break; + case KeyCode.Escape: + res = UnityEngine.InputSystem.Key.Escape; + break; + case KeyCode.Backspace: + res = UnityEngine.InputSystem.Key.Backspace; + break; + case KeyCode.Tab: + res = UnityEngine.InputSystem.Key.Tab; + break; + case KeyCode.LeftShift: + res = UnityEngine.InputSystem.Key.LeftShift; + break; + case KeyCode.RightShift: + res = UnityEngine.InputSystem.Key.RightShift; + break; + case KeyCode.LeftControl: + res = UnityEngine.InputSystem.Key.LeftCtrl; + break; + case KeyCode.RightControl: + res = UnityEngine.InputSystem.Key.RightCtrl; + break; + case KeyCode.LeftAlt: + res = UnityEngine.InputSystem.Key.LeftAlt; + break; + case KeyCode.RightAlt: + res = UnityEngine.InputSystem.Key.RightAlt; + break; + case KeyCode.LeftCommand: + res = UnityEngine.InputSystem.Key.LeftCommand; + break; + case KeyCode.RightCommand: + res = UnityEngine.InputSystem.Key.RightCommand; + break; + case KeyCode.LeftWindows: + res = UnityEngine.InputSystem.Key.LeftWindows; + break; + case KeyCode.RightWindows: + res = UnityEngine.InputSystem.Key.RightWindows; + break; + case KeyCode.UpArrow: + res = UnityEngine.InputSystem.Key.UpArrow; + break; + case KeyCode.DownArrow: + res = UnityEngine.InputSystem.Key.DownArrow; + break; + case KeyCode.LeftArrow: + res = UnityEngine.InputSystem.Key.LeftArrow; + break; + case KeyCode.RightArrow: + res = UnityEngine.InputSystem.Key.RightArrow; + break; + case KeyCode.F1: + res = UnityEngine.InputSystem.Key.F1; + break; + case KeyCode.F2: + res = UnityEngine.InputSystem.Key.F2; + break; + case KeyCode.F3: + res = UnityEngine.InputSystem.Key.F3; + break; + case KeyCode.F4: + res = UnityEngine.InputSystem.Key.F4; + break; + case KeyCode.F5: + res = UnityEngine.InputSystem.Key.F5; + break; + case KeyCode.F6: + res = UnityEngine.InputSystem.Key.F6; + break; + case KeyCode.F7: + res = UnityEngine.InputSystem.Key.F7; + break; + case KeyCode.F8: + res = UnityEngine.InputSystem.Key.F8; + break; + case KeyCode.F9: + res = UnityEngine.InputSystem.Key.F9; + break; + case KeyCode.F10: + res = UnityEngine.InputSystem.Key.F10; + break; + case KeyCode.F11: + res = UnityEngine.InputSystem.Key.F11; + break; + case KeyCode.F12: + res = UnityEngine.InputSystem.Key.F12; + break; + case KeyCode.Insert: + res = UnityEngine.InputSystem.Key.Insert; + break; + case KeyCode.Delete: + res = UnityEngine.InputSystem.Key.Delete; + break; + case KeyCode.Home: + res = UnityEngine.InputSystem.Key.Home; + break; + case KeyCode.End: + res = UnityEngine.InputSystem.Key.End; + break; + case KeyCode.PageUp: + res = UnityEngine.InputSystem.Key.PageUp; + break; + case KeyCode.PageDown: + res = UnityEngine.InputSystem.Key.PageDown; + break; + case KeyCode.Keypad0: + res = UnityEngine.InputSystem.Key.Numpad0; + break; + case KeyCode.Keypad1: + res = UnityEngine.InputSystem.Key.Numpad1; + break; + case KeyCode.Keypad2: + res = UnityEngine.InputSystem.Key.Numpad2; + break; + case KeyCode.Keypad3: + res = UnityEngine.InputSystem.Key.Numpad3; + break; + case KeyCode.Keypad4: + res = UnityEngine.InputSystem.Key.Numpad4; + break; + case KeyCode.Keypad5: + res = UnityEngine.InputSystem.Key.Numpad5; + break; + case KeyCode.Keypad6: + res = UnityEngine.InputSystem.Key.Numpad6; + break; + case KeyCode.Keypad7: + res = UnityEngine.InputSystem.Key.Numpad7; + break; + case KeyCode.Keypad8: + res = UnityEngine.InputSystem.Key.Numpad8; + break; + case KeyCode.Keypad9: + res = UnityEngine.InputSystem.Key.Numpad9; + break; + case KeyCode.KeypadDivide: + res = UnityEngine.InputSystem.Key.NumpadDivide; + break; + case KeyCode.KeypadMultiply: + res = UnityEngine.InputSystem.Key.NumpadMultiply; + break; + case KeyCode.KeypadMinus: + res = UnityEngine.InputSystem.Key.NumpadMinus; + break; + case KeyCode.KeypadPlus: + res = UnityEngine.InputSystem.Key.NumpadPlus; + break; + case KeyCode.KeypadEnter: + res = UnityEngine.InputSystem.Key.NumpadEnter; + break; + case KeyCode.KeypadPeriod: + res = UnityEngine.InputSystem.Key.NumpadPeriod; + break; + case KeyCode.CapsLock: + res = UnityEngine.InputSystem.Key.CapsLock; + break; + case KeyCode.ScrollLock: + res = UnityEngine.InputSystem.Key.ScrollLock; + break; + case KeyCode.Pause: + res = UnityEngine.InputSystem.Key.Pause; + break; + case KeyCode.Quote: + res = UnityEngine.InputSystem.Key.Quote; + break; + case KeyCode.Comma: + res = UnityEngine.InputSystem.Key.Comma; + break; + case KeyCode.Minus: + res = UnityEngine.InputSystem.Key.Minus; + break; + case KeyCode.Period: + res = UnityEngine.InputSystem.Key.Period; + break; + case KeyCode.Slash: + res = UnityEngine.InputSystem.Key.Slash; + break; + case KeyCode.Semicolon: + res = UnityEngine.InputSystem.Key.Semicolon; + break; + case KeyCode.Equals: + res = UnityEngine.InputSystem.Key.Equals; + break; + case KeyCode.LeftBracket: + res = UnityEngine.InputSystem.Key.LeftBracket; + break; + case KeyCode.RightBracket: + res = UnityEngine.InputSystem.Key.RightBracket; + break; + case KeyCode.Backslash: + res = UnityEngine.InputSystem.Key.Backslash; + break; + case KeyCode.BackQuote: + res = UnityEngine.InputSystem.Key.Backquote; + break; + default: + res = UnityEngine.InputSystem.Key.Space; + break; + } + + return res; + } +#endif + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/InputKeyConverter.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/InputKeyConverter.cs.meta new file mode 100644 index 00000000..48404807 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/InputKeyConverter.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: cccdf44e0a2330943a3295398ea7d21c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/InputKeyConverter.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/MissingScriptsRemover.cs b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/MissingScriptsRemover.cs new file mode 100644 index 00000000..8cda562d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/MissingScriptsRemover.cs @@ -0,0 +1,15 @@ +using UnityEditor; +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class MissingScriptsRemover : MonoBehaviour + { + private void Awake() + { +#if UNITY_EDITOR + GameObjectUtility.RemoveMonoBehavioursWithMissingScript(gameObject); +#endif + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/MissingScriptsRemover.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/MissingScriptsRemover.cs.meta new file mode 100644 index 00000000..1dfdd924 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/MissingScriptsRemover.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 90cc15f056763f54d825836fc0dda30b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Scripts/MissingScriptsRemover.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures.meta new file mode 100644 index 00000000..690e5f76 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2079251647b8b824abecc812d174a9f3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png new file mode 100644 index 00000000..342ffd3c Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png.meta new file mode 100644 index 00000000..8deabb06 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png.meta @@ -0,0 +1,204 @@ +fileFormatVersion: 2 +guid: 07103c52b3aaeca4da8a83361edd059f +TextureImporter: + internalIDToNameTable: + - first: + 213: 21300000 + second: Boy + - first: + 213: 21300002 + second: Girl + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + ignoreMasterTextureLimit: 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 1 + cookieLightType: 1 + 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: 1 + - 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: 1 + - 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: 1 + - 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: 1 + - 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: 1 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: Boy + rect: + serializedVersion: 2 + x: 3 + y: 495 + width: 566 + height: 485 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 6b3b5448e2e55624aa5325fede49615b + internalID: 21300000 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: Girl + rect: + serializedVersion: 2 + x: 526 + y: 34 + width: 486 + height: 484 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: d759c9ac7a1ec634cbff17145cdcce9e + internalID: 21300002 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 396e3acf790e9eb478ef7901a27a3a08 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: + Boy: 21300000 + Girl: 21300002 + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/BoyGirl.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png new file mode 100644 index 00000000..8eb1b1ec Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png.meta new file mode 100644 index 00000000..71d2881f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png.meta @@ -0,0 +1,353 @@ +fileFormatVersion: 2 +guid: 4b40fc0f65c85f14fbc9c7c5f40ca686 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + 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 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 3 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 4 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 4 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: + - - {x: 0, y: 2} + - {x: -0.09813535, y: 1.9975909} + - {x: -0.19603428, y: 1.9903694} + - {x: -0.29346094, y: 1.978353} + - {x: -0.39018065, y: 1.9615705} + - {x: -0.4859604, y: 1.9400625} + - {x: -0.5805693, y: 1.9138807} + - {x: -0.67377967, y: 1.8830881} + - {x: -0.76536685, y: 1.8477591} + - {x: -0.8551101, y: 1.8079786} + - {x: -0.9427934, y: 1.7638426} + - {x: -1.0282055, y: 1.7154572} + - {x: -1.1111405, y: 1.6629392} + - {x: -1.1913986, y: 1.606415} + - {x: -1.2687867, y: 1.5460209} + - {x: -1.343118, y: 1.4819021} + - {x: -1.4142137, y: 1.4142134} + - {x: -1.4819024, y: 1.3431177} + - {x: -1.5460211, y: 1.2687864} + - {x: -1.6064153, y: 1.1913984} + - {x: -1.6629394, y: 1.1111403} + - {x: -1.7154574, y: 1.0282052} + - {x: -1.7638427, y: 0.94279313} + - {x: -1.8079787, y: 0.8551098} + - {x: -1.8477592, y: 0.76536644} + - {x: -1.8830884, y: 0.6737792} + - {x: -1.9138808, y: 0.5805688} + - {x: -1.9400626, y: 0.48595977} + - {x: -1.9615707, y: 0.39018002} + - {x: -1.9783531, y: 0.29346028} + - {x: -1.9903696, y: 0.19603357} + - {x: -1.9975909, y: 0.098134585} + - {x: -2, y: -0.0000008026785} + - {x: -1.9975909, y: -0.09813619} + - {x: -1.9903693, y: -0.19603516} + - {x: -1.9783529, y: -0.29346186} + - {x: -1.9615704, y: -0.3901816} + - {x: -1.9400623, y: -0.48596132} + - {x: -1.9138803, y: -0.58057034} + - {x: -1.8830878, y: -0.67378074} + - {x: -1.8477587, y: -0.7653679} + - {x: -1.8079782, y: -0.855111} + - {x: -1.7638422, y: -0.9427941} + - {x: -1.715457, y: -1.028206} + - {x: -1.6629391, y: -1.1111407} + - {x: -1.606415, y: -1.1913987} + - {x: -1.546021, y: -1.2687865} + - {x: -1.4819025, y: -1.3431177} + - {x: -1.4142139, y: -1.4142132} + - {x: -1.3431184, y: -1.4819018} + - {x: -1.2687873, y: -1.5460204} + - {x: -1.1913995, y: -1.6064144} + - {x: -1.1111416, y: -1.6629385} + - {x: -1.0282067, y: -1.7154565} + - {x: -0.9427949, y: -1.7638417} + - {x: -0.85511184, y: -1.8079778} + - {x: -0.76536876, y: -1.8477583} + - {x: -0.6737818, y: -1.8830874} + - {x: -0.5805717, y: -1.91388} + - {x: -0.48596293, y: -1.9400618} + - {x: -0.39018345, y: -1.96157} + - {x: -0.29346398, y: -1.9783525} + - {x: -0.1960375, y: -1.9903691} + - {x: -0.09813879, y: -1.9975908} + - {x: -0.0000036398517, y: -2} + - {x: 0.098131515, y: -1.9975911} + - {x: 0.19603026, y: -1.9903698} + - {x: 0.29345676, y: -1.9783536} + - {x: 0.3901763, y: -1.9615715} + - {x: 0.48595586, y: -1.9400636} + - {x: 0.58056474, y: -1.913882} + - {x: 0.67377496, y: -1.8830898} + - {x: 0.765362, y: -1.847761} + - {x: 0.8551053, y: -1.8079809} + - {x: 0.94278854, y: -1.7638452} + - {x: 1.0282005, y: -1.7154602} + - {x: 1.1111355, y: -1.6629425} + - {x: 1.1913936, y: -1.6064187} + - {x: 1.2687817, y: -1.5460249} + - {x: 1.3431131, y: -1.4819067} + - {x: 1.4142088, y: -1.4142184} + - {x: 1.4818976, y: -1.3431231} + - {x: 1.5460167, y: -1.2687918} + - {x: 1.6064112, y: -1.1914037} + - {x: 1.6629357, y: -1.1111456} + - {x: 1.7154542, y: -1.0282105} + - {x: 1.7638398, y: -0.94279844} + - {x: 1.8079762, y: -0.855115} + - {x: 1.8477571, y: -0.76537156} + - {x: 1.8830866, y: -0.6737842} + - {x: 1.9138794, y: -0.5805737} + - {x: 1.9400615, y: -0.48596448} + - {x: 1.9615698, y: -0.39018452} + - {x: 1.9783524, y: -0.29346457} + - {x: 1.9903691, y: -0.19603767} + - {x: 1.9975908, y: -0.09813846} + - {x: 2, y: -0.0000028371733} + - {x: 1.997591, y: 0.0981328} + - {x: 1.9903697, y: 0.19603202} + - {x: 1.9783533, y: 0.29345897} + - {x: 1.9615709, y: 0.39017895} + - {x: 1.9400629, y: 0.48595896} + - {x: 1.9138811, y: 0.58056825} + - {x: 1.8830885, y: 0.6737789} + - {x: 1.8477592, y: 0.7653663} + - {x: 1.8079787, y: 0.8551099} + - {x: 1.7638426, y: 0.9427934} + - {x: 1.7154571, y: 1.0282056} + - {x: 1.662939, y: 1.1111408} + - {x: 1.6064146, y: 1.1913992} + - {x: 1.5460203, y: 1.2687874} + - {x: 1.4819014, y: 1.3431189} + - {x: 1.4142125, y: 1.4142147} + - {x: 1.3431165, y: 1.4819036} + - {x: 1.2687849, y: 1.5460223} + - {x: 1.1913966, y: 1.6064166} + - {x: 1.1111382, y: 1.6629407} + - {x: 1.0282029, y: 1.7154588} + - {x: 0.94279057, y: 1.7638441} + - {x: 0.85510695, y: 1.8079801} + - {x: 0.76536334, y: 1.8477606} + - {x: 0.67377585, y: 1.8830895} + - {x: 0.58056515, y: 1.9138819} + - {x: 0.48595583, y: 1.9400636} + - {x: 0.3901758, y: 1.9615716} + - {x: 0.29345578, y: 1.9783537} + - {x: 0.1960288, y: 1.99037} + - {x: 0.09812956, y: 1.9975911} + physicsShape: + - - {x: 0, y: 2} + - {x: -0.09813535, y: 1.9975909} + - {x: -0.19603428, y: 1.9903694} + - {x: -0.29346094, y: 1.978353} + - {x: -0.39018065, y: 1.9615705} + - {x: -0.4859604, y: 1.9400625} + - {x: -0.5805693, y: 1.9138807} + - {x: -0.67377967, y: 1.8830881} + - {x: -0.76536685, y: 1.8477591} + - {x: -0.8551101, y: 1.8079786} + - {x: -0.9427934, y: 1.7638426} + - {x: -1.0282055, y: 1.7154572} + - {x: -1.1111405, y: 1.6629392} + - {x: -1.1913986, y: 1.606415} + - {x: -1.2687867, y: 1.5460209} + - {x: -1.343118, y: 1.4819021} + - {x: -1.4142137, y: 1.4142134} + - {x: -1.4819024, y: 1.3431177} + - {x: -1.5460211, y: 1.2687864} + - {x: -1.6064153, y: 1.1913984} + - {x: -1.6629394, y: 1.1111403} + - {x: -1.7154574, y: 1.0282052} + - {x: -1.7638427, y: 0.94279313} + - {x: -1.8079787, y: 0.8551098} + - {x: -1.8477592, y: 0.76536644} + - {x: -1.8830884, y: 0.6737792} + - {x: -1.9138808, y: 0.5805688} + - {x: -1.9400626, y: 0.48595977} + - {x: -1.9615707, y: 0.39018002} + - {x: -1.9783531, y: 0.29346028} + - {x: -1.9903696, y: 0.19603357} + - {x: -1.9975909, y: 0.098134585} + - {x: -2, y: -0.0000008026785} + - {x: -1.9975909, y: -0.09813619} + - {x: -1.9903693, y: -0.19603516} + - {x: -1.9783529, y: -0.29346186} + - {x: -1.9615704, y: -0.3901816} + - {x: -1.9400623, y: -0.48596132} + - {x: -1.9138803, y: -0.58057034} + - {x: -1.8830878, y: -0.67378074} + - {x: -1.8477587, y: -0.7653679} + - {x: -1.8079782, y: -0.855111} + - {x: -1.7638422, y: -0.9427941} + - {x: -1.715457, y: -1.028206} + - {x: -1.6629391, y: -1.1111407} + - {x: -1.606415, y: -1.1913987} + - {x: -1.546021, y: -1.2687865} + - {x: -1.4819025, y: -1.3431177} + - {x: -1.4142139, y: -1.4142132} + - {x: -1.3431184, y: -1.4819018} + - {x: -1.2687873, y: -1.5460204} + - {x: -1.1913995, y: -1.6064144} + - {x: -1.1111416, y: -1.6629385} + - {x: -1.0282067, y: -1.7154565} + - {x: -0.9427949, y: -1.7638417} + - {x: -0.85511184, y: -1.8079778} + - {x: -0.76536876, y: -1.8477583} + - {x: -0.6737818, y: -1.8830874} + - {x: -0.5805717, y: -1.91388} + - {x: -0.48596293, y: -1.9400618} + - {x: -0.39018345, y: -1.96157} + - {x: -0.29346398, y: -1.9783525} + - {x: -0.1960375, y: -1.9903691} + - {x: -0.09813879, y: -1.9975908} + - {x: -0.0000036398517, y: -2} + - {x: 0.098131515, y: -1.9975911} + - {x: 0.19603026, y: -1.9903698} + - {x: 0.29345676, y: -1.9783536} + - {x: 0.3901763, y: -1.9615715} + - {x: 0.48595586, y: -1.9400636} + - {x: 0.58056474, y: -1.913882} + - {x: 0.67377496, y: -1.8830898} + - {x: 0.765362, y: -1.847761} + - {x: 0.8551053, y: -1.8079809} + - {x: 0.94278854, y: -1.7638452} + - {x: 1.0282005, y: -1.7154602} + - {x: 1.1111355, y: -1.6629425} + - {x: 1.1913936, y: -1.6064187} + - {x: 1.2687817, y: -1.5460249} + - {x: 1.3431131, y: -1.4819067} + - {x: 1.4142088, y: -1.4142184} + - {x: 1.4818976, y: -1.3431231} + - {x: 1.5460167, y: -1.2687918} + - {x: 1.6064112, y: -1.1914037} + - {x: 1.6629357, y: -1.1111456} + - {x: 1.7154542, y: -1.0282105} + - {x: 1.7638398, y: -0.94279844} + - {x: 1.8079762, y: -0.855115} + - {x: 1.8477571, y: -0.76537156} + - {x: 1.8830866, y: -0.6737842} + - {x: 1.9138794, y: -0.5805737} + - {x: 1.9400615, y: -0.48596448} + - {x: 1.9615698, y: -0.39018452} + - {x: 1.9783524, y: -0.29346457} + - {x: 1.9903691, y: -0.19603767} + - {x: 1.9975908, y: -0.09813846} + - {x: 2, y: -0.0000028371733} + - {x: 1.997591, y: 0.0981328} + - {x: 1.9903697, y: 0.19603202} + - {x: 1.9783533, y: 0.29345897} + - {x: 1.9615709, y: 0.39017895} + - {x: 1.9400629, y: 0.48595896} + - {x: 1.9138811, y: 0.58056825} + - {x: 1.8830885, y: 0.6737789} + - {x: 1.8477592, y: 0.7653663} + - {x: 1.8079787, y: 0.8551099} + - {x: 1.7638426, y: 0.9427934} + - {x: 1.7154571, y: 1.0282056} + - {x: 1.662939, y: 1.1111408} + - {x: 1.6064146, y: 1.1913992} + - {x: 1.5460203, y: 1.2687874} + - {x: 1.4819014, y: 1.3431189} + - {x: 1.4142125, y: 1.4142147} + - {x: 1.3431165, y: 1.4819036} + - {x: 1.2687849, y: 1.5460223} + - {x: 1.1913966, y: 1.6064166} + - {x: 1.1111382, y: 1.6629407} + - {x: 1.0282029, y: 1.7154588} + - {x: 0.94279057, y: 1.7638441} + - {x: 0.85510695, y: 1.8079801} + - {x: 0.76536334, y: 1.8477606} + - {x: 0.67377585, y: 1.8830895} + - {x: 0.58056515, y: 1.9138819} + - {x: 0.48595583, y: 1.9400636} + - {x: 0.3901758, y: 1.9615716} + - {x: 0.29345578, y: 1.9783537} + - {x: 0.1960288, y: 1.99037} + - {x: 0.09812956, y: 1.9975911} + bones: [] + spriteID: 9a5d93fd276093242b4d07bd28b8611a + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Circle.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png new file mode 100644 index 00000000..61278688 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png.meta new file mode 100644 index 00000000..9c1472ad --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: 49cc75da86b2bb949b1235ad2a384f9b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 47b0447a9c1f42444a0656dca4167218 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/IceTexture.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png new file mode 100644 index 00000000..73a14c68 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png.meta new file mode 100644 index 00000000..06e3c292 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 7f33f36658f399a44be84455bcd911b1 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 4ac03ff046060d047baa00b1ec42dcf2 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic1.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png new file mode 100644 index 00000000..c14ef28d Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png.meta new file mode 100644 index 00000000..13def0b6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png.meta @@ -0,0 +1,128 @@ +fileFormatVersion: 2 +guid: 2ea3ea54c499d314f957e0a47dc11c9c +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 2 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: af5c8d9995b9cee40bde0cdd45bcd67c + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Magic2.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png new file mode 100644 index 00000000..321d6c0d Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png.meta new file mode 100644 index 00000000..18119e75 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: c6ad7b22efb776c448982ca631b16f73 +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 + ignoreMasterTextureLimit: 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: WebGL + 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: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTexture.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png new file mode 100644 index 00000000..4fa037cd Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png.meta new file mode 100644 index 00000000..41f8d106 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: fdff8a56ae2c830478b84c6807aa0408 +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 + ignoreMasterTextureLimit: 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: WebGL + 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: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/RockTextureNormal.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png new file mode 100644 index 00000000..8eb1b1ec Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png.meta new file mode 100644 index 00000000..90778900 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png.meta @@ -0,0 +1,105 @@ +fileFormatVersion: 2 +guid: fab06e0be9375cc4d823efa71629885c +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + 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 + 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 3 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 4 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: 4 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: + - - {x: -2, y: -2} + - {x: -2, y: 2} + - {x: 2, y: 2} + - {x: 2, y: -2} + physicsShape: + - - {x: -2, y: -2} + - {x: -2, y: 2} + - {x: 2, y: 2} + - {x: 2, y: -2} + bones: [] + spriteID: a6651eff1c5cc3945bb789d5017c08a6 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/Square.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png new file mode 100644 index 00000000..af0123ff Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png.meta new file mode 100644 index 00000000..1892fb37 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: fd279c0d74378ff48b61c27ffc8873eb +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 + ignoreMasterTextureLimit: 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: WebGL + 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: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTexture.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png new file mode 100644 index 00000000..b9716d19 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png.meta new file mode 100644 index 00000000..e73f63f6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 47c3680e2892fa44b80abb6447b1a619 +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 + ignoreMasterTextureLimit: 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: WebGL + 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: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/WoodTextureNormal.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png new file mode 100644 index 00000000..4ff3facd Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png.meta new file mode 100644 index 00000000..853c9429 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png.meta @@ -0,0 +1,141 @@ +fileFormatVersion: 2 +guid: 758ac31a9bff9ac4181f54de54a6ecb7 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 150 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 00ec50f99942acb49b4119afac5cab4c + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/backMountain.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png new file mode 100644 index 00000000..2f041b92 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png.meta new file mode 100644 index 00000000..5c0c732a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: be304275dbf36014ca9828884588ac47 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: d8ea15f629e486e4f8c115ff7f00f1b4 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coals.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png new file mode 100644 index 00000000..9657e9ef Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png.meta new file mode 100644 index 00000000..9ae1f382 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 487cb2374bc49b848a1f4577212201cc +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: bfb7e5498e23b9d418474e1af6babf32 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/coalsEmissive.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png new file mode 100644 index 00000000..050a0018 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png.meta new file mode 100644 index 00000000..0d9140b3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png.meta @@ -0,0 +1,204 @@ +fileFormatVersion: 2 +guid: adce45105552071409c959137cb5b670 +TextureImporter: + internalIDToNameTable: + - first: + 213: 21300000 + second: flag_0 + - first: + 213: 21300002 + second: flag_1 + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 50 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 1 + cookieLightType: 1 + 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: 1 + - 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: 1 + - 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: 1 + - 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: 1 + - 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: 1 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: flag_0 + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 63 + height: 217 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 02305410000000000800000000000000 + internalID: 21300000 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: flag_1 + rect: + serializedVersion: 2 + x: 94 + y: 103 + width: 109 + height: 88 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 22305410000000000800000000000000 + internalID: 21300002 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: + flag_0: 21300000 + flag_1: 21300002 + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flag.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png new file mode 100644 index 00000000..ede75d01 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png.meta new file mode 100644 index 00000000..8bd815cf --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: bd6f48b4407043345b1a3a07df8c4d61 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: fbcc62d8a76faef47aa92538608d3b3a + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/flameShape.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png new file mode 100644 index 00000000..0551124f Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png.meta new file mode 100644 index 00000000..f0c50b77 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png.meta @@ -0,0 +1,141 @@ +fileFormatVersion: 2 +guid: cf7e1f6ebb800154db2b215cba9330ee +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 4096 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 4096 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 4096 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 4096 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 4096 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: a7ab056890d43d6478c408756e97f7cf + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/grass.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png new file mode 100644 index 00000000..385c3b5e Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png.meta new file mode 100644 index 00000000..afee0454 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 2f5c9cbfde2d0384bb53189b0d0f06d8 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 7f8abd90ff7053b4cabb4381c9c4ebe7 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shield.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png new file mode 100644 index 00000000..5610b57e Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png.meta new file mode 100644 index 00000000..44d65f5c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 81687001a52d8024fb3706ba7619ad4b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 09f38e087cda7674aadf332d14971ac4 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/shieldGlow.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png new file mode 100644 index 00000000..7d844990 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png.meta new file mode 100644 index 00000000..a9a02373 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: ab4465ab72ca5544da8e8dd1110b6973 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: e56be7ecdc13c4f4eb4bb8416c9ae7f7 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/snowFlake.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png new file mode 100644 index 00000000..90f68b6e Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png.meta new file mode 100644 index 00000000..4137c7b0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png.meta @@ -0,0 +1,176 @@ +fileFormatVersion: 2 +guid: 519dafacd208bb64c83d5124be03b09d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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: 1 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 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: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 1 + cookieLightType: 1 + 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: 1 + - 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: 1 + - 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: 1 + - 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: 1 + - 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: 1 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: spaceSoldier_0 + rect: + serializedVersion: 2 + x: 90 + y: 78 + width: 343 + height: 365 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 3ff258c9fcbbf944588103ed4f2d80bc + internalID: -7390147391288916661 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 7a4cf885a6f9c7248896d6d365331dbf + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: + spaceSoldier_0: -7390147391288916661 + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldier.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png new file mode 100644 index 00000000..596e35af Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png.meta new file mode 100644 index 00000000..6e7ff3aa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png.meta @@ -0,0 +1,141 @@ +fileFormatVersion: 2 +guid: 065da6c7b90ca904dab9cbc6b415fd19 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 481e92f540418f34584627b3c56549ce + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierColorSwap.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png new file mode 100644 index 00000000..491624c1 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png.meta new file mode 100644 index 00000000..eba39e5c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png.meta @@ -0,0 +1,141 @@ +fileFormatVersion: 2 +guid: 8608ef90f91271745a17f7210fe1e7db +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 4d8dce05bf843a6418e48e1088ee3234 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierGlow.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png new file mode 100644 index 00000000..e067a6f0 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png.meta new file mode 100644 index 00000000..b001bcff --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: 3d311990b7c2c59478bacea537a60a53 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: f3d4f7c1ae047ba4b94a0e777a486bab + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierHelmetTopMask.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png new file mode 100644 index 00000000..12292a67 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png.meta new file mode 100644 index 00000000..38ecc3c1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png.meta @@ -0,0 +1,119 @@ +fileFormatVersion: 2 +guid: 994e4deee74379d4c83bcf0f27585f73 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 1483eb4f6241cec44b70c2198a1733c7 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spaceSoldierNormal.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png new file mode 100644 index 00000000..ae4c5acd Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png.meta new file mode 100644 index 00000000..a0bc4d5e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: 48bde3d73ebadd04783e0c4cb7276007 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 1d800d516dfd14b47a3e68d573c77319 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/spark.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png new file mode 100644 index 00000000..9d3ac45f Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png.meta new file mode 100644 index 00000000..a88316b9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png.meta @@ -0,0 +1,97 @@ +fileFormatVersion: 2 +guid: 51caeab4d98b55046a9013cc2da7e427 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 107ae09ce492f7745be900c7e931a59d + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/splotch.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png new file mode 100644 index 00000000..dd97caf0 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png.meta new file mode 100644 index 00000000..e3536c12 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 73d3cc63327012249b4f98eb9289311d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 8332df90c7094ac47862f6375f5366fe + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/sunDoodle.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png new file mode 100644 index 00000000..d7cbe5fb Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png.meta b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png.meta new file mode 100644 index 00000000..f8dd5ec0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png.meta @@ -0,0 +1,141 @@ +fileFormatVersion: 2 +guid: bd3249e8aae01e748aaca0c062e2c19c +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 119475dc3468b4a47b838a35c5bfa22b + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Demo/Textures/water.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Documentation.pdf b/Assets/Plugins/AllIn1SpriteShader/Documentation.pdf new file mode 100644 index 00000000..26c564c5 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Documentation.pdf differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Documentation.pdf.meta b/Assets/Plugins/AllIn1SpriteShader/Documentation.pdf.meta new file mode 100644 index 00000000..a8e5e26f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Documentation.pdf.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 593198a96eec1d74c8549e7b54168503 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Documentation.pdf + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials.meta b/Assets/Plugins/AllIn1SpriteShader/Materials.meta new file mode 100644 index 00000000..2637c87c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 345f2705e87e7424683ef2bd17d38c26 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat b/Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat new file mode 100644 index 00000000..6b63a79d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat @@ -0,0 +1,178 @@ +%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: EmptyMaterial + m_Shader: {fileID: 4800000, guid: a36b7719ff0465b42ab1407d67672c5f, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 32e8df0008bebe746b1681a71c61f31c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _Glow: 0 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat.meta new file mode 100644 index 00000000..bb88de95 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: cc460e5b1c6c0bd498b44195a0c3da99 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Materials/EmptyMaterial.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat b/Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat new file mode 100644 index 00000000..5698c93c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat @@ -0,0 +1,210 @@ +%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: ScaledTIme + m_Shader: {fileID: 4800000, guid: f3622b3ac1631ea409b0f5811034f3a9, type: 3} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaRoundThreshold: 0.5 + - _BillboardY: 0 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 1 + - _ClipUvLeft: 1 + - _ClipUvRight: 1 + - _ClipUvUp: 1 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _GlitchSize: 1 + - _Glow: 0 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GradBoostX: 1.2 + - _GradBoostY: 1.2 + - _GradIsRadial: 0 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramFlickerPercent: 0.05 + - _HologramMaxAlpha: 1 + - _HologramMinAlpha: 0 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HologramUnmodAmount: 0.4 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MaxXUV: 1 + - _MaxYUV: 1 + - _MinXUV: 0 + - _MinYUV: 0 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _MyDstMode: 10 + - _MySrcMode: 5 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _OnlyInnerOutline: 0 + - _OnlyOutline: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RandomSeed: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _ShineGlow: 1 + - _ShineLocation: 0.5 + - _ShineRotate: 0 + - _ShineWidth: 0.1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _HologramStripeColor: {r: 0, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} + - _ShineColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat.meta new file mode 100644 index 00000000..ea9a55ec --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 3241ea466d4f8334898daf420de4026b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Materials/ScaledTIme.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat b/Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat new file mode 100644 index 00000000..bf67988c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat @@ -0,0 +1,177 @@ +%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: UIStencil + m_Shader: {fileID: 4800000, guid: a53f4bb29f3644b43b5075c6dcfecb32, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorSwapTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + 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} + - _OutlineDistortTex: + m_Texture: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _BlurHD: 0 + - _BlurIntensity: 10 + - _ChromAberrAlpha: 0.4 + - _ChromAberrAmount: 1 + - _ClipUvDown: 0 + - _ClipUvLeft: 0 + - _ClipUvRight: 0 + - _ClipUvUp: 0 + - _ColorChangeLuminosity: 0 + - _ColorChangeTolerance: 0.25 + - _ColorRampLuminosity: 0 + - _ColorRampOutline: 0 + - _ColorSwapBlueLuminosity: 0.5 + - _ColorSwapGreenLuminosity: 0.5 + - _ColorSwapRedLuminosity: 0.5 + - _DistortAmount: 0.5 + - _DistortTexXSpeed: 5 + - _DistortTexYSpeed: 5 + - _FadeAmount: -0.1 + - _FadeBurnGlow: 2 + - _FadeBurnTransition: 0.075 + - _FadeBurnWidth: 0.025 + - _FishEyeUvAmount: 0.35 + - _FlickerAlpha: 0 + - _FlickerFreq: 0.2 + - _FlickerPercent: 0.05 + - _GhostColorBoost: 1 + - _GhostTransparency: 0 + - _GlitchAmount: 3 + - _Glow: 10 + - _GlowTexUsed: 0 + - _GradBlend: 1 + - _GrassManualAnim: 1 + - _GrassManualToggle: 0 + - _GrassSpeed: 2 + - _GrassWind: 20 + - _GreyscaleLuminosity: 0 + - _GreyscaleOutline: 0 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HitEffectBlend: 1 + - _HitEffectGlow: 5 + - _HologramFlickerAlpha: 0 + - _HologramFlickerFreq: 0.2 + - _HologramStripesAlpha: 0.4 + - _HologramStripesAmount: 50 + - _HologramStripesFill: 0.4 + - _HologramStripesLuminosity: 1 + - _HologramStripesSpeed: 5 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _InnerOutlineAlpha: 1 + - _InnerOutlineGlow: 1 + - _InnerOutlineThickness: 1 + - _MotionBlurAngle: 0.1 + - _MotionBlurDist: 1.25 + - _NegativeAmount: 1 + - _OffsetUvX: 0 + - _OffsetUvY: 0 + - _Outline8Directions: 0 + - _OutlineAlpha: 1 + - _OutlineDistortAmount: 0.5 + - _OutlineDistortTexXSpeed: 5 + - _OutlineDistortTexYSpeed: 5 + - _OutlineDistortToggle: 0 + - _OutlineGlow: 1.5 + - _OutlineIsPixel: 0 + - _OutlinePixelWidth: 1 + - _OutlineTexGrey: 0 + - _OutlineTexToggle: 0 + - _OutlineTexXSpeed: 10 + - _OutlineTexYSpeed: 0 + - _OutlineWidth: 0.004 + - _PinchUvAmount: 0.35 + - _PixelateSize: 32 + - _PosterizeGamma: 0.75 + - _PosterizeNumColors: 8 + - _PosterizeOutline: 0 + - _RectSize: 1 + - _RotateUvAmount: 0 + - _ShadowAlpha: 0.5 + - _ShadowX: 0.1 + - _ShadowY: -0.05 + - _ShakeUvSpeed: 2.5 + - _ShakeUvX: 1.5 + - _ShakeUvY: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZoomUvAmount: 0.5 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorChangeNewCol: {r: 1, g: 1, b: 0, a: 1} + - _ColorChangeTarget: {r: 1, g: 0, b: 0, a: 1} + - _ColorSwapBlue: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapGreen: {r: 1, g: 1, b: 1, a: 1} + - _ColorSwapRed: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _GradBotLeftCol: {r: 0, g: 0, b: 1, a: 1} + - _GradBotRightCol: {r: 0, g: 0, b: 1, a: 1} + - _GradTopLeftCol: {r: 1, g: 0, b: 0, a: 1} + - _GradTopRightCol: {r: 1, g: 0, b: 0, a: 1} + - _GreyscaleTintColor: {r: 1, g: 1, b: 1, a: 1} + - _HitEffectColor: {r: 1, g: 1, b: 1, a: 1} + - _InnerOutlineColor: {r: 1, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 1} + - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat.meta b/Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat.meta new file mode 100644 index 00000000..e8be5c87 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7ef34f26b8117334c8ecd9c27a45e2c6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Materials/UIStencil.mat + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts.meta new file mode 100644 index 00000000..25e7f5c2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4e5ef1ce32696cd4c8ddbe3e0e172819 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs new file mode 100644 index 00000000..6ecf90ba --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs @@ -0,0 +1,96 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace AllIn1SpriteShader +{ + [ExecuteInEditMode] + public class All1CreateUnifiedOutline : MonoBehaviour + { + [SerializeField] private Material outlineMaterial = null; + [SerializeField] private Transform outlineParentTransform = null; + + [Space] + [Header("Only needed if Sprite (ignored if UI)")] + [SerializeField] private int duplicateOrderInLayer = -100; + [SerializeField] private string duplicateSortingLayer = "Default"; + + [Space] + [Header("This operation will delete the component")] + [SerializeField] private bool createUnifiedOutline; + + void Update() + { + if (createUnifiedOutline) + { + if (outlineMaterial == null) + { + createUnifiedOutline = false; + MissingMaterial(); + return; + } + + List children = new List(); + GetAllChildren(transform, ref children); + foreach (Transform t in children) CreateOutlineSpriteDuplicate(t.gameObject); + CreateOutlineSpriteDuplicate(gameObject); + + DestroyImmediate(this); + } + } + + private void CreateOutlineSpriteDuplicate(GameObject target) + { + bool objectIsUi = false; + SpriteRenderer ownSr = target.GetComponent(); + Image ownImage = target.GetComponent(); + if (ownSr != null) objectIsUi = false; + else if (ownImage != null) objectIsUi = true; + else if (ownSr == null && ownImage == null && !transform.Equals(outlineParentTransform)) return; + + GameObject objDuplicate = new GameObject(); + objDuplicate.name = target.name + "Outline"; + objDuplicate.transform.position = target.transform.position; + objDuplicate.transform.rotation = target.transform.rotation; + objDuplicate.transform.localScale = target.transform.lossyScale; + if (outlineParentTransform == null) objDuplicate.transform.parent = target.transform; + else objDuplicate.transform.parent = outlineParentTransform; + + if (!objectIsUi) + { + SpriteRenderer sr = objDuplicate.AddComponent(); + sr.sprite = ownSr.sprite; + sr.sortingOrder = duplicateOrderInLayer; + sr.sortingLayerName = duplicateSortingLayer; + sr.material = outlineMaterial; + sr.flipX = ownSr.flipX; + sr.flipY = ownSr.flipY; + } + else + { + Image image = objDuplicate.AddComponent(); + image.sprite = ownImage.sprite; + image.material = outlineMaterial; + } + } + + private void MissingMaterial() + { +#if UNITY_EDITOR + EditorUtility.DisplayDialog("Missing Material", "Please assign a Material For New Duplicate and try again", "Ok"); +#endif + } + + private void GetAllChildren(Transform parent, ref List transforms) + { + foreach (Transform child in parent) + { + transforms.Add(child); + GetAllChildren(child, ref transforms); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs.meta new file mode 100644 index 00000000..718ef5f1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 264cca4d0f5bbb54eb9de18ca54d1506 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/All1CreateUnifiedOutline.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs new file mode 100644 index 00000000..240ba1d8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs @@ -0,0 +1,829 @@ +using System.Collections.Generic; +using System.IO; +using UnityEditor; +using UnityEngine; +using UnityEngine.Tilemaps; +using UnityEngine.UI; +#if UNITY_EDITOR +using UnityEditor.SceneManagement; +#endif + +namespace AllIn1SpriteShader +{ + [ExecuteInEditMode] + [DisallowMultipleComponent] + [AddComponentMenu("AllIn1SpriteShader/AddAllIn1Shader")] + public class AllIn1Shader : MonoBehaviour + { + public enum ShaderTypes + { + Default = 0, + ScaledTime = 1, + MaskedUI = 2, + Urp2dRenderer = 3, + Lit = 5, + SRPBatcher = 6, + Invalid = 4, + } + public ShaderTypes currentShaderType = ShaderTypes.Invalid; + + private Material currMaterial, prevMaterial; + private bool destroyed = false; +#if UNITY_EDITOR + private bool matAssigned = false; +#endif + private enum AfterSetAction { Clear, CopyMaterial, Reset}; + + [Range(1f, 20f)] public float normalStrength = 5f; + [Range(0f, 3f)] public int normalSmoothing = 1; + [HideInInspector] public bool computingNormal = false; + +#if UNITY_EDITOR + private static float timeLastReload = -1f; + private void Start() + { + if(timeLastReload < 0) timeLastReload = Time.time; + } + + private void Update() + { + if (matAssigned || Application.isPlaying || !gameObject.activeSelf) return; + Renderer sr = GetComponent(); + if (sr != null) + { + if (sr.sharedMaterial == null) + { + CleanMaterial(); + MakeNewMaterial(true); + } + if (sr.sharedMaterial.name.Contains("Default")) MakeNewMaterial(true); + else matAssigned = true; + } + else + { + Graphic img = GetComponent(); + if (img != null) + { + if (img.material.name.Contains("Default")) MakeNewMaterial(true); + else matAssigned = true; + } + } + } +#endif + + private void MakeNewMaterial(bool getShaderTypeFromPrefs, string shaderName = "AllIn1SpriteShader") + { + bool operationSuccessful = SetMaterial(AfterSetAction.Clear, getShaderTypeFromPrefs, shaderName); + #if UNITY_EDITOR + if(operationSuccessful) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Material Created and Assigned"); + #endif + } + + public bool MakeCopy() + { + return SetMaterial(AfterSetAction.CopyMaterial, false, GetStringFromShaderType()); + } + + private void ResetAllProperties(bool getShaderTypeFromPrefs, string shaderName) + { + SetMaterial(AfterSetAction.Reset, getShaderTypeFromPrefs, shaderName); + } + + private string GetStringFromShaderType() + { + currentShaderType = ShaderTypes.Default; + if (currentShaderType == ShaderTypes.Default) return "AllIn1SpriteShader"; + else if (currentShaderType == ShaderTypes.ScaledTime) return "AllIn1SpriteShaderScaledTime"; + else if (currentShaderType == ShaderTypes.MaskedUI) return "AllIn1SpriteShaderUiMask"; + else if (currentShaderType == ShaderTypes.Urp2dRenderer) return "AllIn1Urp2dRenderer"; + else if (currentShaderType == ShaderTypes.Lit) return "AllIn1SpriteShaderLit"; + else if (currentShaderType == ShaderTypes.SRPBatcher) return "AllIn1SpriteShaderSRPBatch"; + + else return "AllIn1SpriteShader"; + } + + private bool SetMaterial(AfterSetAction action, bool getShaderTypeFromPrefs, string shaderName) + { + #if UNITY_EDITOR + Shader allIn1Shader = AllIn1ShaderWindow.FindShader(shaderName); + if (getShaderTypeFromPrefs) + { + int shaderVariant = PlayerPrefs.GetInt("allIn1DefaultShader"); + currentShaderType = (ShaderTypes)shaderVariant; + if (shaderVariant == 1) allIn1Shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderScaledTime"); + else if (shaderVariant == 2) allIn1Shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderUiMask"); + else if (shaderVariant == 3) allIn1Shader = AllIn1ShaderWindow.FindShader("AllIn1Urp2dRenderer"); + else if (shaderVariant == 5) allIn1Shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderLit"); + else if (shaderVariant == 6) allIn1Shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderSRPBatch"); + } + + if (!Application.isPlaying && Application.isEditor && allIn1Shader != null) + { + bool rendererExists = false; + Renderer sr = GetComponent(); + if (sr != null) + { + rendererExists = true; + int renderingQueue = 3000; + if(action == AfterSetAction.CopyMaterial) renderingQueue = GetComponent().sharedMaterial.renderQueue; + prevMaterial = new Material(GetComponent().sharedMaterial); + currMaterial = new Material(allIn1Shader); + currMaterial.renderQueue = renderingQueue; + GetComponent().sharedMaterial = currMaterial; + GetComponent().sharedMaterial.hideFlags = HideFlags.None; + matAssigned = true; + + DoAfterSetAction(action); + } + else + { + Graphic img = GetComponent(); + if (img != null) + { + rendererExists = true; + int renderingQueue = 3000; + if(action == AfterSetAction.CopyMaterial) renderingQueue = img.material.renderQueue; + prevMaterial = new Material(img.material); + currMaterial = new Material(allIn1Shader); + currMaterial.renderQueue = renderingQueue; + img.material = currMaterial; + img.material.hideFlags = HideFlags.None; + matAssigned = true; + DoAfterSetAction(action); + } + } + if (!rendererExists) + { + MissingRenderer(); + return false; + } + else + { + SetSceneDirty(); + return true; + } + } + else if (allIn1Shader == null) + { + #if UNITY_EDITOR + string logErrorMessage = "Make sure all AllIn1SpriteShader shader variants are present. Maybe delete the asset and download it again?"; + Debug.LogError(logErrorMessage); + AllIn1ShaderWindow.ShowSceneViewNotification(logErrorMessage); + #endif + return false; + } + #endif + return false; + } + + private void DoAfterSetAction(AfterSetAction action) + { + switch (action) + { + case AfterSetAction.Clear: + ClearAllKeywords(); + break; + case AfterSetAction.CopyMaterial: + currMaterial.CopyPropertiesFromMaterial(prevMaterial); + break; + } + } + + public bool TryCreateNew() + { + bool rendererExists = false; + Renderer sr = GetComponent(); + if (sr != null) + { + rendererExists = true; + if (sr != null && sr.sharedMaterial != null && sr.sharedMaterial.name.Contains("AllIn1")) + { + ResetAllProperties(false, GetStringFromShaderType()); + ClearAllKeywords(); + } + else + { + CleanMaterial(); + MakeNewMaterial(false, GetStringFromShaderType()); + } + } + else + { + Graphic img = GetComponent(); + if (img != null) + { + rendererExists = true; + if (img.material.name.Contains("AllIn1")) + { + ResetAllProperties(false, GetStringFromShaderType()); + ClearAllKeywords(); + } + else MakeNewMaterial(false, GetStringFromShaderType()); + } + } + if (!rendererExists) + { + MissingRenderer(); + } + SetSceneDirty(); + return rendererExists; + } + + public void ClearAllKeywords() + { + SetKeyword("RECTSIZE_ON"); + SetKeyword("OFFSETUV_ON"); + SetKeyword("CLIPPING_ON"); + SetKeyword("POLARUV_ON"); + SetKeyword("TWISTUV_ON"); + SetKeyword("ROTATEUV_ON"); + SetKeyword("FISHEYE_ON"); + SetKeyword("PINCH_ON"); + SetKeyword("SHAKEUV_ON"); + SetKeyword("WAVEUV_ON"); + SetKeyword("ROUNDWAVEUV_ON"); + SetKeyword("DOODLE_ON"); + SetKeyword("ZOOMUV_ON"); + SetKeyword("FADE_ON"); + SetKeyword("TEXTURESCROLL_ON"); + SetKeyword("GLOW_ON"); + SetKeyword("OUTBASE_ON"); + SetKeyword("ONLYOUTLINE_ON"); + SetKeyword("OUTTEX_ON"); + SetKeyword("OUTDIST_ON"); + SetKeyword("DISTORT_ON"); + SetKeyword("WIND_ON"); + SetKeyword("GRADIENT_ON"); + SetKeyword("GRADIENT2COL_ON"); + SetKeyword("RADIALGRADIENT_ON"); + SetKeyword("COLORSWAP_ON"); + SetKeyword("HSV_ON"); + SetKeyword("HITEFFECT_ON"); + SetKeyword("PIXELATE_ON"); + SetKeyword("NEGATIVE_ON"); + SetKeyword("GRADIENTCOLORRAMP_ON"); + SetKeyword("COLORRAMP_ON"); + SetKeyword("GREYSCALE_ON"); + SetKeyword("POSTERIZE_ON"); + SetKeyword("BLUR_ON"); + SetKeyword("MOTIONBLUR_ON"); + SetKeyword("GHOST_ON"); + SetKeyword("ALPHAOUTLINE_ON"); + SetKeyword("INNEROUTLINE_ON"); + SetKeyword("ONLYINNEROUTLINE_ON"); + SetKeyword("HOLOGRAM_ON"); + SetKeyword("CHROMABERR_ON"); + SetKeyword("GLITCH_ON"); + SetKeyword("FLICKER_ON"); + SetKeyword("SHADOW_ON"); + SetKeyword("SHINE_ON"); + SetKeyword("CONTRAST_ON"); + SetKeyword("OVERLAY_ON"); + SetKeyword("OVERLAYMULT_ON"); + SetKeyword("ALPHACUTOFF_ON"); + SetKeyword("ALPHAROUND_ON"); + SetKeyword("CHANGECOLOR_ON"); + SetKeyword("CHANGECOLOR2_ON"); + SetKeyword("CHANGECOLOR3_ON"); + SetKeyword("FOG_ON"); + SetSceneDirty(); + } + + private void SetKeyword(string keyword, bool state = false) + { + if (destroyed) return; + if (currMaterial == null) + { + FindCurrMaterial(); + if (currMaterial == null) + { + MissingRenderer(); + return; + } + } + if (!state) currMaterial.DisableKeyword(keyword); + else currMaterial.EnableKeyword(keyword); + } + + private void FindCurrMaterial() + { + Renderer sr = GetComponent(); + if (sr != null) + { + currMaterial = GetComponent().sharedMaterial; +#if UNITY_EDITOR + matAssigned = true; +#endif + } + else + { + Graphic img = GetComponent(); + if (img != null) + { + currMaterial = img.material; +#if UNITY_EDITOR + matAssigned = true; +#endif + } + } + } + + public void CleanMaterial() + { + Renderer sr = GetComponent(); + if (sr != null) + { + sr.sharedMaterial = new Material(Shader.Find("Sprites/Default")); +#if UNITY_EDITOR + matAssigned = false; +#endif + } + else + { + Graphic img = GetComponent(); + if (img != null) + { + img.material = new Material(Shader.Find("Sprites/Default")); +#if UNITY_EDITOR + matAssigned = false; +#endif + } + } + SetSceneDirty(); + } + + public bool SaveMaterial() + { +#if UNITY_EDITOR + string sameMaterialPath = AllIn1ShaderWindow.GetMaterialSavePath(); + sameMaterialPath += "/"; + if (!System.IO.Directory.Exists(sameMaterialPath)) + { + EditorUtility.DisplayDialog("The desired Material Save Path doesn't exist", + "Go to Window -> AllIn1ShaderWindow and set a valid folder", "Ok"); + return false; + } + sameMaterialPath += gameObject.name; + string fullPath = sameMaterialPath + ".mat"; + if (System.IO.File.Exists(fullPath)) + { + SaveMaterialWithOtherName(sameMaterialPath); + } + else DoSaving(fullPath); + SetSceneDirty(); + return true; +#else + return false; +#endif + } + private void SaveMaterialWithOtherName(string path, int i = 1) + { + int number = i; + string newPath = path + "_" + number.ToString(); + string fullPath = newPath + ".mat"; + if (System.IO.File.Exists(fullPath)) + { + number++; + SaveMaterialWithOtherName(path, number); + } + else + { + DoSaving(fullPath); + } + } + + private void DoSaving(string fileName) + { +#if UNITY_EDITOR + bool rendererExists = false; + Renderer sr = GetComponent(); + Material matToSave = null; + Material createdMat = null; + if (sr != null) + { + rendererExists = true; + matToSave = sr.sharedMaterial; + } + else + { + Graphic img = GetComponent(); + if (img != null) + { + rendererExists = true; + matToSave = img.material; + } + } + if (!rendererExists) + { + MissingRenderer(); + return; + } + else + { + createdMat = new Material(matToSave); + currMaterial = createdMat; + AssetDatabase.CreateAsset(createdMat, fileName); + Debug.Log(fileName + " has been saved!"); + EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(fileName, typeof(Material))); + } + if (sr != null) + { + sr.material = createdMat; + } + else + { + Graphic img = GetComponent(); + img.material = createdMat; + } +#endif + } + + public void SetSceneDirty() + { +#if UNITY_EDITOR + if (!Application.isPlaying) EditorSceneManager.MarkAllScenesDirty(); + + //If you get an error here please delete the code block below + #if UNITY_2021_2_OR_NEWER + var prefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); + #else + var prefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); + #endif + if (prefabStage != null) EditorSceneManager.MarkSceneDirty(prefabStage.scene); + //Until here +#endif + } + + private void MissingRenderer() + { +#if UNITY_EDITOR + EditorUtility.DisplayDialog("Missing Renderer", "This GameObject (" + + gameObject.name + ") has no Renderer or UI Image component. This AllIn1Shader component will be removed.", "Ok"); + destroyed = true; + DestroyImmediate(this); +#endif + } + + public bool ToggleSetAtlasUvs(bool activate) + { + bool success = false; + SetAtlasUvs atlasUvs = GetComponent(); + if (activate) + { + if (atlasUvs == null) atlasUvs = gameObject.AddComponent(); + if (atlasUvs != null) success = atlasUvs.GetAndSetUVs(); + if(success) SetKeyword("ATLAS_ON", true); + } + else + { + if (atlasUvs != null) + { + atlasUvs.ResetAtlasUvs(); + DestroyImmediate(atlasUvs); + success = true; + } + else + { + #if UNITY_EDITOR + EditorUtility.DisplayDialog("Missing Atlas Uv Setup", "This GameObject (" + gameObject.name + ") has no Atlas Uv Setup.", "Ok"); + #endif + return false; + } + SetKeyword("ATLAS_ON", false); + } + SetSceneDirty(); + return success; + } + + public bool ApplyMaterialToHierarchy() + { + Renderer sr = GetComponent(); + Graphic image = GetComponent(); + Material matToApply = null; + if (sr != null) matToApply = sr.sharedMaterial; + else if (image != null) + { + matToApply = image.material; + } + else + { + MissingRenderer(); + return false; + } + + List children = new List(); + GetAllChildren(transform, ref children); + bool hasPerformedOperation = false; + foreach (Transform t in children) + { + sr = t.gameObject.GetComponent(); + if (sr != null) sr.material = matToApply; + else + { + image = t.gameObject.GetComponent(); + if (image != null) image.material = matToApply; + } + hasPerformedOperation = true; + } + + return hasPerformedOperation; + } + + public void CheckIfValidTarget() + { + Renderer sr = GetComponent(); + Graphic image = GetComponent(); + if (sr == null && image == null) MissingRenderer(); + } + + private void GetAllChildren(Transform parent, ref List transforms) + { + foreach (Transform child in parent) + { + transforms.Add(child); + GetAllChildren(child, ref transforms); + } + } + + public bool RenderToImage() + { +#if UNITY_EDITOR + if (currMaterial == null) + { + FindCurrMaterial(); + if (currMaterial == null) + { + MissingRenderer(); + return false; + } + } + Texture tex = currMaterial.GetTexture("_MainTex"); + if(tex != null) + { + bool success = RenderAndSaveTexture(currMaterial, tex); + if(!success) return false; + } + else + { + SpriteRenderer sr = GetComponent(); + Graphic i = GetComponent(); + if (sr != null && sr.sprite != null && sr.sprite.texture != null) tex = sr.sprite.texture; + else if (i != null && i.mainTexture != null) tex = i.mainTexture; + + if(tex != null) + { + bool success = RenderAndSaveTexture(currMaterial, tex); + if(!success) return false; + } + else{ + EditorUtility.DisplayDialog("No valid target texture found", "All In 1 Shader component couldn't find a valid Main Texture in this GameObject (" + + gameObject.name + "). This means that the material you are using has no Main Texture or that the texture couldn't be reached through the Renderer component you are using." + + " Please make sure to have a valid Main Texture in the Material or Renderer/Graphic component", "Ok"); + return false; + } + } + return true; +#else + return false; +#endif + } + + private bool RenderAndSaveTexture(Material targetMaterial, Texture targetTexture) + { +#if UNITY_EDITOR + float scaleSlider = 1; + if (PlayerPrefs.HasKey("All1ShaderRenderImagesScale")) scaleSlider = PlayerPrefs.GetFloat("All1ShaderRenderImagesScale"); + RenderTexture renderTarget = new RenderTexture((int)(targetTexture.width * scaleSlider), (int)(targetTexture.height * scaleSlider), 0, RenderTextureFormat.ARGB32); + Graphics.Blit(targetTexture, renderTarget, targetMaterial); + Texture2D reaultTex = new Texture2D(renderTarget.width, renderTarget.height, TextureFormat.ARGB32, false); + reaultTex.ReadPixels(new Rect(0, 0, renderTarget.width, renderTarget.height), 0, 0); + reaultTex.Apply(); + + string path = AllIn1ShaderWindow.GetRenderImageSavePath(); + path += "/"; + if (!System.IO.Directory.Exists(path)) + { + EditorUtility.DisplayDialog("The desired Material to Image Save Path doesn't exist", + "Go to Window -> AllIn1ShaderWindow and set a valid folder", "Ok"); + return false; + } + string fullPath = path + gameObject.name + ".png"; + if (System.IO.File.Exists(fullPath)) fullPath = GetNewValidPath(path + gameObject.name); + string pingPath = fullPath; + + string fileName = fullPath.Replace(path, ""); + fileName = fileName.Replace(".png", ""); + fullPath = EditorUtility.SaveFilePanel("Save Render Image", path, fileName, "png"); + if(string.IsNullOrEmpty(fullPath)) + { + Debug.Log("Save operation was cancelled or no valid path was selected."); + return false; + } + + byte[] bytes = reaultTex.EncodeToPNG(); + File.WriteAllBytes(fullPath, bytes); + AssetDatabase.ImportAsset(subPath); + AssetDatabase.Refresh(); + DestroyImmediate(reaultTex); + EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(pingPath, typeof(Texture))); + Debug.Log("Render Image saved to: " + fullPath + " with scale: " + scaleSlider + " (it can be changed in Window -> AllIn1ShaderWindow)"); + return true; +#else + return false; +#endif + + } + + private string GetNewValidPath(string path, int i = 1) + { + int number = i; + string newPath = path + "_" + number.ToString(); + string fullPath = newPath + ".png"; + if (System.IO.File.Exists(fullPath)) + { + number++; + fullPath = GetNewValidPath(path, number); + } + return fullPath; + } + + #region normalMapCreator + protected virtual void OnEnable() + { +#if UNITY_EDITOR + EditorApplication.update += OnEditorUpdate; +#endif + } + + protected virtual void OnDisable() + { +#if UNITY_EDITOR + EditorApplication.update -= OnEditorUpdate; +#endif + } + + bool needToWait; + int waitingCycles; + int timesWeWaited; + protected virtual void OnEditorUpdate() + { + if (computingNormal) + { + if (needToWait) + { + waitingCycles++; + if (waitingCycles > 5) + { + needToWait = false; + timesWeWaited++; + } + } + else + { + if (timesWeWaited == 1) SetNewNormalTexture2(); + if (timesWeWaited == 2) SetNewNormalTexture3(); + if (timesWeWaited == 3) SetNewNormalTexture4(); + needToWait = true; + } + } + } + + SpriteRenderer normalMapSr; + Renderer normalMapRenderer; + bool isSpriteRenderer; + public void CreateAndAssignNormalMap() + { +#if UNITY_EDITOR + if (GetComponent() != null) + { + EditorUtility.DisplayDialog("This is a tilemap", "This feature isn't supported on Tilemap Renderers." + + " Add a secondary normal map texture instead (you can create a Normal Map in the asset Window)", "Ok"); + return; + } + + normalMapSr = GetComponent(); + normalMapRenderer = GetComponent(); + //Debug.LogError($"NORMALMAP_ON: {normalMapRenderer.sharedMaterial.IsKeywordEnabled("NORMALMAP_ON")} -t:{Time.time}"); + if (normalMapSr != null) + { + isSpriteRenderer = true; + SetNewNormalTexture(); + if(!normalMapSr.sharedMaterial.IsKeywordEnabled("NORMALMAP_ON")) normalMapSr.sharedMaterial.EnableKeyword("NORMALMAP_ON"); + } + else if (normalMapRenderer != null) + { + isSpriteRenderer = false; + SetNewNormalTexture(); + if(!normalMapRenderer.sharedMaterial.IsKeywordEnabled("NORMALMAP_ON")) normalMapRenderer.sharedMaterial.EnableKeyword("NORMALMAP_ON"); + } + else + { + if (GetComponent() != null) + { + EditorUtility.DisplayDialog("This is a UI element", "This GameObject (" + + gameObject.name + ") is a UI element. UI elements probably shouldn't have a normal map. Why are you using the light shader variant?", "Ok"); + } + else + { + MissingRenderer(); + } + return; + } +#endif + } + + string path; + private void SetNewNormalTexture() + { +#if UNITY_EDITOR + path = AllIn1ShaderWindow.GetNormalMapSavePath(); + path += "/"; + if (!System.IO.Directory.Exists(path)) + { + EditorUtility.DisplayDialog("The desired folder doesn't exist", + "Go to Window -> AllIn1ShaderWindow and set a valid folder", "Ok"); + return; + } + + computingNormal = true; + needToWait = true; + waitingCycles = 0; + timesWeWaited = 0; +#else + computingNormal = false; + return; +#endif + } + +#if UNITY_EDITOR + TextureImporter importer; + Texture2D mainTex2D; +#endif + private void SetNewNormalTexture2() + { +#if UNITY_EDITOR + if (!isSpriteRenderer) + { + mainTex2D = (Texture2D)normalMapRenderer.sharedMaterial.GetTexture("_MainTex"); + importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(mainTex2D)) as TextureImporter; + } + else importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(normalMapSr.sprite)) as TextureImporter; + + importer.isReadable = true; + importer.SaveAndReimport(); +#endif + } + + string subPath; + private void SetNewNormalTexture3() + { +#if UNITY_EDITOR + Texture2D normalM = null; + if(isSpriteRenderer) normalM = AllIn1ShaderWindow.CreateNormalMap(normalMapSr.sprite.texture, normalStrength, normalSmoothing); + else normalM = AllIn1ShaderWindow.CreateNormalMap(mainTex2D, normalStrength, normalSmoothing); + + byte[] bytes = normalM.EncodeToPNG(); + + path += gameObject.name; + subPath = path + ".png"; + string dataPath = Application.dataPath; + dataPath = dataPath.Replace("/Assets", "/"); + string fullPath = dataPath + subPath; + + File.WriteAllBytes(fullPath, bytes); + AssetDatabase.ImportAsset(subPath); + AssetDatabase.Refresh(); + DestroyImmediate(normalM); +#endif + } + + private void SetNewNormalTexture4() + { +#if UNITY_EDITOR + importer = AssetImporter.GetAtPath(subPath) as TextureImporter; + importer.filterMode = FilterMode.Bilinear; + importer.textureType = TextureImporterType.NormalMap; + importer.wrapMode = TextureWrapMode.Repeat; + importer.SaveAndReimport(); + + if (currMaterial == null) + { + FindCurrMaterial(); + if (currMaterial == null) + { + MissingRenderer(); + return; + } + } + Texture2D normalTex = (Texture2D)AssetDatabase.LoadAssetAtPath(subPath, typeof(Texture2D)); + currMaterial.SetTexture("_NormalMap", normalTex); + + Debug.Log("Normal texture saved to: " + subPath); + EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(subPath, typeof(Texture))); + + computingNormal = false; +#endif + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs.meta new file mode 100644 index 00000000..6c101bbf --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: ee158225ee1e59f4791627785501d950 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1Shader.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs new file mode 100644 index 00000000..01c435bb --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs @@ -0,0 +1,695 @@ +#if UNITY_EDITOR +using System.IO; +using UnityEditor; +using UnityEngine; + +namespace AllIn1SpriteShader +{ + public class AllIn1ShaderWindow : EditorWindow + { + private const string versionString = "4.68"; + [MenuItem("Tools/AllIn1/SpriteShaderWindow")] + public static void ShowAllIn1ShaderWindowWindow() + { + GetWindow("All In 1 Shader Window"); + } + + public static readonly string CUSTOM_EDITOR_HEADER = "AllIn1SpriteShaderEditorImage"; + private static string basePath = "Assets/Plugins/AllIn1SpriteShader"; + public static readonly string materialsSavesRelativePath = "/Materials"; + public static readonly string renderImagesSavesRelativePath = "/Textures"; + public static readonly string normalMapSavesRelativePath = "/Textures/NormalMaps"; + public static readonly string gradientSavesRelativePath = "/Textures/GradientTextures"; + + public Vector2 scrollPosition = Vector2.zero; + private Texture2D imageInspector; + private DefaultAsset materialTargetFolder = null; + private GUIStyle style, bigLabel = new GUIStyle(), titleStyle = new GUIStyle(); + private const int bigFontSize = 16; + + AllIn1Shader.ShaderTypes shaderTypes = AllIn1Shader.ShaderTypes.Default; + bool showUrpWarning = false; + double warningTime = 0f; + + private Texture2D targetNormalImage; + private float normalStrength = 5f; + private int normalSmoothing = 1; + private int isComputingNormals = 0; + + private enum TextureSizes + { + _2 = 2, + _4 = 4, + _8 = 8, + _16 = 16, + _32 = 32, + _64 = 64, + _128 = 128, + _256 = 256, + _512 = 512, + _1024 = 1024, + _2048 = 2048 + } + private TextureSizes textureSizes = TextureSizes._128; + [SerializeField] private Gradient gradient = new Gradient(); + private FilterMode gradientFiltering = FilterMode.Bilinear; + + private enum ImageType + { + ShowImage, + HideInComponent, + HideEverywhere + } + private ImageType imageType; + + private void OnGUI() + { + style = new GUIStyle(EditorStyles.helpBox); + style.margin = new RectOffset(0, 0, 0, 0); + bigLabel = new GUIStyle(EditorStyles.boldLabel); + bigLabel.fontSize = bigFontSize; + titleStyle.alignment = TextAnchor.MiddleLeft; + + using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPosition, GUILayout.Width(position.width), GUILayout.Height(position.height))) + { + scrollPosition = scrollView.scrollPosition; + + ShowImageAndSetImageEditorPref(); + + ShowAssetImageOptionsToggle(); + + DefaultAssetShader(); + + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Material Save Path", bigLabel); + GUILayout.Space(20); + GUILayout.Label("Select the folder where new Materials will be saved when the Save Material To Folder button of the asset component is pressed", EditorStyles.boldLabel); + HandleSaveFolderEditorPref("All1ShaderMaterials", basePath + materialsSavesRelativePath, "Material"); + + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Render Material to Image Save Path", bigLabel); + GUILayout.Space(20); + EditorGUILayout.BeginHorizontal(); + { + float scaleSlider = 1; + if (PlayerPrefs.HasKey("All1ShaderRenderImagesScale")) scaleSlider = PlayerPrefs.GetFloat("All1ShaderRenderImagesScale"); + GUILayout.Label("Rendered Image Texture Scale", GUILayout.MaxWidth(190)); + scaleSlider = EditorGUILayout.Slider(scaleSlider, 0.2f, 5f, GUILayout.MaxWidth(200)); + if (GUILayout.Button("Default Value", GUILayout.MaxWidth(100))) PlayerPrefs.SetFloat("All1ShaderRenderImagesScale", 1f); + else PlayerPrefs.SetFloat("All1ShaderRenderImagesScale", scaleSlider); + } + EditorGUILayout.EndVertical(); + GUILayout.Label("Select the folder where new Images will be saved when the Render Material To Image button of the asset component is pressed", EditorStyles.boldLabel); + HandleSaveFolderEditorPref("All1ShaderRenderImages", basePath + renderImagesSavesRelativePath, "Images"); + + DrawLine(Color.grey, 1, 3); + NormalMapCreator(); + + DrawLine(Color.grey, 1, 3); + GradientCreator(); + + DrawLine(Color.grey, 1, 3); + GUILayout.Space(10); + SceneNotificationsToggle(); + + DrawLine(Color.grey, 1, 3); + GUILayout.Space(10); + RefreshLitShader(); + + GUILayout.Space(10); + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Current asset version is " + versionString, EditorStyles.boldLabel); + } + } + + private void ShowImageAndSetImageEditorPref() + { + if(!EditorPrefs.HasKey("allIn1ImageConfig")) + { + EditorPrefs.SetInt("allIn1ImageConfig", (int) ImageType.ShowImage); + } + + imageType = (ImageType) EditorPrefs.GetInt("allIn1ImageConfig"); + if(imageType == ImageType.HideEverywhere) return; + switch(imageType) + { + case ImageType.ShowImage: + case ImageType.HideInComponent: + if(imageInspector == null) imageInspector = GetInspectorImage(); + break; + } + + if(imageInspector) + { + Rect rect = EditorGUILayout.GetControlRect(GUILayout.Height(50)); + GUI.DrawTexture(rect, imageInspector, ScaleMode.ScaleToFit, true); + } + DrawLine(Color.grey, 1, 3); + } + + public static Texture2D GetInspectorImage() => GetImage(CUSTOM_EDITOR_HEADER); + + private static Texture2D GetImage(string textureName) + { + string[] guids = AssetDatabase.FindAssets($"{textureName} t:texture"); + if(guids.Length > 0) + { + string path = AssetDatabase.GUIDToAssetPath(guids[0]); + return AssetDatabase.LoadAssetAtPath(path); + } + return null; + } + + private void ShowAssetImageOptionsToggle() + { + GUILayout.Label("Asset Image Display Options", bigLabel); + GUILayout.Space(20); + + int previousImageType = (int) imageType; + imageType = (ImageType) EditorGUILayout.EnumPopup(imageType, GUILayout.MaxWidth(200)); + if((int) imageType != previousImageType) EditorPrefs.SetInt("allIn1ImageConfig", (int) imageType); + + DrawLine(Color.grey, 1, 3); + } + + private void DefaultAssetShader() + { + GUILayout.Label("Default Asset Shader", bigLabel); + GUILayout.Space(20); + GUILayout.Label("This is the shader variant that will be assigned by default to Sprites and UI Images when the asset component is added", EditorStyles.boldLabel); + + bool isUrp = false; + Shader temp = FindShader("AllIn1Urp2dRenderer"); + if (temp != null) isUrp = true; + + shaderTypes = (AllIn1Shader.ShaderTypes)PlayerPrefs.GetInt("allIn1DefaultShader"); + int previousShaderType = (int)shaderTypes; + shaderTypes = (AllIn1Shader.ShaderTypes)EditorGUILayout.EnumPopup(shaderTypes, GUILayout.MaxWidth(200)); + + if (previousShaderType != (int)shaderTypes) + { + if (!isUrp && shaderTypes == AllIn1Shader.ShaderTypes.Urp2dRenderer) + { + showUrpWarning = true; + warningTime = EditorApplication.timeSinceStartup + 5; + } + else + { + PlayerPrefs.SetInt("allIn1DefaultShader", (int)shaderTypes); + showUrpWarning = false; + } + } + + if (warningTime < EditorApplication.timeSinceStartup) showUrpWarning = false; + if (isUrp) showUrpWarning = false; + if (!isUrp && !showUrpWarning && shaderTypes == AllIn1Shader.ShaderTypes.Urp2dRenderer) + { + showUrpWarning = true; + warningTime = EditorApplication.timeSinceStartup + 5; + shaderTypes = AllIn1Shader.ShaderTypes.Default; + PlayerPrefs.SetInt("allIn1DefaultShader", (int)shaderTypes); + } + + if (showUrpWarning) EditorGUILayout.HelpBox( + "You can't set the URP 2D Renderer variant since you didn't import the URP package available in the asset root folder (SEE DOCUMENTATION)", + MessageType.Error, + true); + } + + private void NormalMapCreator() + { + GUILayout.Label("Normal Map Creator", bigLabel); + + GUILayout.Space(20); + GUILayout.Label("Select the folder where new Normal Maps will be saved when the Create Normal Map button of the asset component is pressed (URP only)", EditorStyles.boldLabel); + HandleSaveFolderEditorPref("All1ShaderNormals", basePath + normalMapSavesRelativePath, "Normal Maps"); + + GUILayout.Space(20); + GUILayout.Label("Assign a sprite you want to create a normal map from. Choose the normal map settings and press the 'Create And Save Normal Map' button", EditorStyles.boldLabel); + targetNormalImage = (Texture2D)EditorGUILayout.ObjectField("Target Image", targetNormalImage, typeof(Texture2D), false, GUILayout.MaxWidth(225)); + + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label("Normal Strength:", GUILayout.MaxWidth(150)); + normalStrength = EditorGUILayout.Slider(normalStrength, 1f, 20f, GUILayout.MaxWidth(400)); + } + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label("Normal Smoothing:", GUILayout.MaxWidth(150)); + normalSmoothing = EditorGUILayout.IntSlider(normalSmoothing, 0, 3, GUILayout.MaxWidth(400)); + } + EditorGUILayout.EndHorizontal(); + + if (isComputingNormals == 0) + { + if (targetNormalImage != null) + { + if (GUILayout.Button("Create And Save Normal Map")) + { + isComputingNormals = 1; + return; + } + } + else + { + GUILayout.Label("Add a Target Image to use this feature", EditorStyles.boldLabel); + } + } + else + { + GUILayout.Label("Normal Map is currently being created, be patient", EditorStyles.boldLabel, GUILayout.Height(40)); + Repaint(); + isComputingNormals++; + if (isComputingNormals > 5) + { + string assetPath = AssetDatabase.GetAssetPath(targetNormalImage); + var tImporter = AssetImporter.GetAtPath(assetPath) as TextureImporter; + if (tImporter != null) + { + tImporter.isReadable = true; + tImporter.SaveAndReimport(); + } + + Texture2D normalToSave = CreateNormalMap(targetNormalImage, normalStrength, normalSmoothing); + + string prefSavedPath = PlayerPrefs.GetString("All1ShaderNormals") + "/"; + string path = prefSavedPath + "NormalMap.png"; + if(System.IO.File.Exists(path)) path = GetNewValidPath(path); + string texName = path.Replace(prefSavedPath, ""); + + path = EditorUtility.SaveFilePanel("Save texture as PNG", prefSavedPath, texName, "png"); + //If you are reading this you might have encountered an error in Unity 2022 Mac builds, if that's the case comment the line above and uncomment the line below + //path = prefSavedPath + texName + ".png"; + + if (path.Length != 0) + { + byte[] pngData = normalToSave.EncodeToPNG(); + if (pngData != null) File.WriteAllBytes(path, pngData); + AssetDatabase.Refresh(); + + if (path.IndexOf("Assets/") >= 0) + { + string subPath = path.Substring(path.IndexOf("Assets/")); + TextureImporter importer = AssetImporter.GetAtPath(subPath) as TextureImporter; + if (importer != null) + { + Debug.Log("Normal Map saved inside the project: " + subPath); + importer.filterMode = FilterMode.Bilinear; + importer.textureType = TextureImporterType.NormalMap; + importer.wrapMode = TextureWrapMode.Repeat; + importer.SaveAndReimport(); + EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(subPath, typeof(Texture))); + } + } + else Debug.Log("Normal Map saved outside the project: " + path); + } + isComputingNormals = 0; + } + } + GUILayout.Label("*This process will freeze the editor for some seconds, larger images will take longer", EditorStyles.boldLabel); + } + + private void HandleSaveFolderEditorPref(string keyName, string defaultPath, string logsFeatureName) + { + if (!PlayerPrefs.HasKey(keyName)) PlayerPrefs.SetString(keyName, defaultPath); + materialTargetFolder = (DefaultAsset)AssetDatabase.LoadAssetAtPath(PlayerPrefs.GetString(keyName), typeof(DefaultAsset)); + if (materialTargetFolder == null) + { + PlayerPrefs.SetString(keyName, defaultPath); + materialTargetFolder = (DefaultAsset)AssetDatabase.LoadAssetAtPath(PlayerPrefs.GetString(keyName), typeof(DefaultAsset)); + if (materialTargetFolder == null) + { + materialTargetFolder = (DefaultAsset)AssetDatabase.LoadAssetAtPath("Assets/", typeof(DefaultAsset)); + if(materialTargetFolder == null) + { + EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(600)); + EditorGUILayout.HelpBox("Folder is invalid, please select a valid one", MessageType.Error, true); + EditorGUILayout.EndHorizontal(); + } + else PlayerPrefs.SetString("Assets/", defaultPath); + } + } + materialTargetFolder = (DefaultAsset)EditorGUILayout.ObjectField("New " + logsFeatureName + " Folder", + materialTargetFolder, typeof(DefaultAsset), false, GUILayout.MaxWidth(500)); + + if (materialTargetFolder != null && IsAssetAFolder(materialTargetFolder)) + { + string path = AssetDatabase.GetAssetPath(materialTargetFolder); + PlayerPrefs.SetString(keyName, path); + EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(600)); + EditorGUILayout.HelpBox("Valid folder! " + logsFeatureName + " save path: " + path, MessageType.Info); + EditorGUILayout.EndHorizontal(); + } + else + { + EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(600)); + EditorGUILayout.HelpBox("Select the new " + logsFeatureName + " Folder", MessageType.Warning, true); + EditorGUILayout.EndHorizontal(); + } + } + + private void GradientCreator() + { + GUILayout.Label("Gradient Creator", bigLabel); + GUILayout.Space(20); + GUILayout.Label("This feature can be used to create textures for the Color Ramp Effect", EditorStyles.boldLabel); + + EditorGUILayout.GradientField("Gradient", gradient, GUILayout.Height(25), GUILayout.MaxWidth(500)); + + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label("Texture Size:", GUILayout.MaxWidth(145)); + textureSizes = (TextureSizes)EditorGUILayout.EnumPopup(textureSizes, GUILayout.MaxWidth(200)); + } + EditorGUILayout.EndHorizontal(); + + int textureSize = (int)textureSizes; + Texture2D gradTex = new Texture2D(textureSize, 1, TextureFormat.RGBA32, false); + for (int i = 0; i < textureSize; i++) gradTex.SetPixel(i, 0, gradient.Evaluate((float)i / (float)textureSize)); + gradTex.Apply(); + + GUILayout.Space(20); + GUILayout.Label("Select the folder where new Gradient Textures will be saved", EditorStyles.boldLabel); + HandleSaveFolderEditorPref("All1ShaderGradients", basePath + gradientSavesRelativePath, "Gradient"); + + string prefSavedPath = PlayerPrefs.GetString("All1ShaderGradients") + "/"; + if (Directory.Exists(prefSavedPath)) + { + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label("Gradient Texture Filtering: ", GUILayout.MaxWidth(170)); + gradientFiltering = (FilterMode)EditorGUILayout.EnumPopup(gradientFiltering, GUILayout.MaxWidth(200)); + } + EditorGUILayout.EndHorizontal(); + + if (GUILayout.Button("Save Gradient Texture", GUILayout.MaxWidth(500))) + { + string path = prefSavedPath + "ColorGradient.png"; + if(System.IO.File.Exists(path)) path = GetNewValidPath(path); + string texName = path.Replace(prefSavedPath, ""); + + path = EditorUtility.SaveFilePanel("Save texture as PNG", prefSavedPath, texName, "png"); + if (path.Length != 0) + { + byte[] pngData = gradTex.EncodeToPNG(); + if (pngData != null) File.WriteAllBytes(path, pngData); + AssetDatabase.Refresh(); + + if (path.IndexOf("Assets/") >= 0) + { + string subPath = path.Substring(path.IndexOf("Assets/")); + TextureImporter importer = AssetImporter.GetAtPath(subPath) as TextureImporter; + if (importer != null) + { + Debug.Log("Gradient saved inside the project: " + subPath); + importer.filterMode = gradientFiltering; + importer.SaveAndReimport(); + EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(subPath, typeof(Texture))); + } + } + else Debug.Log("Gradient saved outside the project: " + path); + } + } + } + } + + private static bool IsAssetAFolder(Object obj) + { + string path = ""; + + if (obj == null) return false; + +#if UNITY_6000_3_OR_NEWER + path = AssetDatabase.GetAssetPath(obj.GetEntityId()); +#else + path = AssetDatabase.GetAssetPath(obj.GetInstanceID()); +#endif + + if (path.Length > 0) + { + if (Directory.Exists(path)) return true; + else return false; + } + return false; + } + + private static string GetNewValidPath(string path, string extension = ".png", int i = 1) + { + int number = i; + path = path.Replace(extension, ""); + string newPath = path + "_" + number.ToString(); + string fullPath = newPath + extension; + if(File.Exists(fullPath)) + { + number++; + fullPath = GetNewValidPath(path, extension, number); + } + + return fullPath; + } + + private void DrawLine(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + r.height = thickness; + r.y += (padding / 2); + r.x -= 2; + r.width += 6; + EditorGUI.DrawRect(r, color); + } + + public static Texture2D CreateNormalMap(Texture2D t, float normalMult = 5f, int normalSmooth = 0) + { + int width = t.width; + int height = t.height; + Color[] sourcePixels = t.GetPixels(); + Color[] resultPixels = new Color[width * height]; + Vector3 vScale = new Vector3(0.3333f, 0.3333f, 0.3333f); + + for(int y = 0; y < height; y++) + { + for(int x = 0; x < width; x++) + { + int index = x + y * width; + Vector3 cSampleNegXNegY = GetPixelClamped(sourcePixels, x - 1, y - 1, width, height); + Vector3 cSampleZerXNegY = GetPixelClamped(sourcePixels, x, y - 1, width, height); + Vector3 cSamplePosXNegY = GetPixelClamped(sourcePixels, x + 1, y - 1, width, height); + Vector3 cSampleNegXZerY = GetPixelClamped(sourcePixels, x - 1, y, width, height); + Vector3 cSamplePosXZerY = GetPixelClamped(sourcePixels, x + 1, y, width, height); + Vector3 cSampleNegXPosY = GetPixelClamped(sourcePixels, x - 1, y + 1, width, height); + Vector3 cSampleZerXPosY = GetPixelClamped(sourcePixels, x, y + 1, width, height); + Vector3 cSamplePosXPosY = GetPixelClamped(sourcePixels, x + 1, y + 1, width, height); + + float fSampleNegXNegY = Vector3.Dot(cSampleNegXNegY, vScale); + float fSampleZerXNegY = Vector3.Dot(cSampleZerXNegY, vScale); + float fSamplePosXNegY = Vector3.Dot(cSamplePosXNegY, vScale); + float fSampleNegXZerY = Vector3.Dot(cSampleNegXZerY, vScale); + float fSamplePosXZerY = Vector3.Dot(cSamplePosXZerY, vScale); + float fSampleNegXPosY = Vector3.Dot(cSampleNegXPosY, vScale); + float fSampleZerXPosY = Vector3.Dot(cSampleZerXPosY, vScale); + float fSamplePosXPosY = Vector3.Dot(cSamplePosXPosY, vScale); + + float edgeX = (fSampleNegXNegY - fSamplePosXNegY) * 0.25f + (fSampleNegXZerY - fSamplePosXZerY) * 0.5f + (fSampleNegXPosY - fSamplePosXPosY) * 0.25f; + float edgeY = (fSampleNegXNegY - fSampleNegXPosY) * 0.25f + (fSampleZerXNegY - fSampleZerXPosY) * 0.5f + (fSamplePosXNegY - fSamplePosXPosY) * 0.25f; + + Vector2 vEdge = new Vector2(edgeX, edgeY) * normalMult; + Vector3 norm = new Vector3(vEdge.x, vEdge.y, 1.0f).normalized; + resultPixels[index] = new Color(norm.x * 0.5f + 0.5f, norm.y * 0.5f + 0.5f, norm.z * 0.5f + 0.5f, 1); + } + } + + if(normalSmooth > 0) + { + resultPixels = SmoothNormals(resultPixels, width, height, normalSmooth); + } + + Texture2D texNormal = new Texture2D(width, height, TextureFormat.RGB24, false, false); + texNormal.SetPixels(resultPixels); + texNormal.Apply(); + return texNormal; + } + + private static Vector3 GetPixelClamped(Color[] pixels, int x, int y, int width, int height) + { + x = Mathf.Clamp(x, 0, width - 1); + y = Mathf.Clamp(y, 0, height - 1); + Color c = pixels[x + y * width]; + return new Vector3(c.r, c.g, c.b); + } + + private static Color[] SmoothNormals(Color[] pixels, int width, int height, int normalSmooth) + { + Color[] smoothedPixels = new Color[pixels.Length]; + float step = 0.00390625f * normalSmooth; + + for(int y = 0; y < height; y++) + { + for(int x = 0; x < width; x++) + { + float pixelsToAverage = 0.0f; + Color c = pixels[x + y * width]; + pixelsToAverage++; + + for(int offsetY = -normalSmooth; offsetY <= normalSmooth; offsetY++) + { + for(int offsetX = -normalSmooth; offsetX <= normalSmooth; offsetX++) + { + if(offsetX == 0 && offsetY == 0) continue; + + int sampleX = Mathf.Clamp(x + offsetX, 0, width - 1); + int sampleY = Mathf.Clamp(y + offsetY, 0, height - 1); + + c += pixels[sampleX + sampleY * width]; + pixelsToAverage++; + } + } + + smoothedPixels[x + y * width] = c / pixelsToAverage; + } + } + + return smoothedPixels; + } + + [MenuItem("Assets/Create/AllIn1Shader Materials/CreateDefaultMaterial")] + public static void CreateDefaultMaterial() + { + CreateMaterial("AllIn1SpriteShader"); + } + + [MenuItem("Assets/Create/AllIn1Shader Materials/CreateScaledTimeMaterial")] + public static void CreateScaledTimeMaterial() + { + CreateMaterial("AllIn1SpriteShaderScaledTime"); + } + + [MenuItem("Assets/Create/AllIn1Shader Materials/CreateUiMaskMaterial")] + public static void CreateUiMaskMaterial() + { + CreateMaterial("AllIn1SpriteShaderUiMask"); + } + + private static void CreateMaterial(string shaderName) + { + string selectedPath = AssetDatabase.GetAssetPath(Selection.activeObject); + + if(!string.IsNullOrEmpty(selectedPath) && Directory.Exists(selectedPath)) + { + Material material = new Material(FindShader(shaderName)); + string fullPath = selectedPath + "/Mat-" + shaderName + ".mat"; + if(File.Exists(fullPath)) fullPath = GetNewValidPath(fullPath, ".mat"); + AssetDatabase.CreateAsset(material, fullPath); + AssetDatabase.Refresh(); + } + else + { + Debug.LogWarning("Please select a valid folder in the Project Window."); + } + } + + private void OnEnable() => GetBasePath(); + + private static void GetBasePath() + { + string[] guids = AssetDatabase.FindAssets("t:folder AllIn1SpriteShader"); + if(guids.Length > 0) + { + basePath = AssetDatabase.GUIDToAssetPath(guids[0]); + } + else + { + Debug.LogError("AllIn1SpriteShader folder not found in the project."); + basePath = "Assets/Plugins/AllIn1SpriteShader"; + } + } + + public static string GetMaterialSavePath() + { + if(!PlayerPrefs.HasKey("All1ShaderMaterials")) + { + GetBasePath(); + return basePath + materialsSavesRelativePath; + } + return PlayerPrefs.GetString("All1ShaderMaterials"); + } + + public static string GetRenderImageSavePath() + { + if(!PlayerPrefs.HasKey("All1ShaderRenderImages")) + { + GetBasePath(); + return basePath + renderImagesSavesRelativePath; + } + return PlayerPrefs.GetString("All1ShaderRenderImages"); + } + + public static string GetNormalMapSavePath() + { + if(!PlayerPrefs.HasKey("All1ShaderNormals")) + { + GetBasePath(); + return basePath + normalMapSavesRelativePath; + } + return PlayerPrefs.GetString("All1ShaderNormals"); + } + + private void SceneNotificationsToggle() + { + float previousLabelWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 200f; + bool areNotificationsEnabled = EditorPrefs.GetInt("DisplaySceneViewNotifications", 1) == 1; + areNotificationsEnabled = EditorGUILayout.Toggle("Display Scene View Notifications", areNotificationsEnabled); + EditorPrefs.SetInt("DisplaySceneViewNotifications", areNotificationsEnabled ? 1 : 0); + EditorGUIUtility.labelWidth = previousLabelWidth; + } + + private static void RefreshLitShader() + { + GUILayout.Label("Force the Lit Shader to be reconfigured"); + GUILayout.Label("If you are getting some error or have changed the render pipeline press the button below"); + if (GUILayout.Button("Refresh Lit Shader", GUILayout.MaxWidth(500f))) + { + AllIn1ShaderImporter.ForceReimport(); + } + } + + public static void SceneViewNotificationAndLog(string message) + { + Debug.Log(message); + ShowSceneViewNotification(message); + } + + public static void ShowSceneViewNotification(string message) + { + bool showNotification = EditorPrefs.GetInt("DisplaySceneViewNotifications", 1) == 1; + if(!showNotification) return; + + GUIContent content = new GUIContent(message); +#if UNITY_2019_1_OR_NEWER + SceneView.lastActiveSceneView.ShowNotification(content, 1.5f); +#else + SceneView.lastActiveSceneView.ShowNotification(content); +#endif + } + + public static Shader FindShader(string shaderName) + { + string[] guids = AssetDatabase.FindAssets($"{shaderName} t:shader"); + foreach(string guid in guids) + { + string path = AssetDatabase.GUIDToAssetPath(guid); + Shader shader = AssetDatabase.LoadAssetAtPath(path); + if(shader != null) + { + string fullShaderName = shader.name; + string actualShaderName = fullShaderName.Substring(fullShaderName.LastIndexOf('/') + 1); + if(actualShaderName.Equals(shaderName)) return shader; + } + } + return null; + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs.meta new file mode 100644 index 00000000..8cb5883a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: b642652081667ab4fad9f2579fec0e51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/AllIn1ShaderWindow.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor.meta new file mode 100644 index 00000000..4d7651e6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 88005189a0eaefe4aa34961fe0208e26 +folderAsset: yes +timeCreated: 1464994693 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn12DRendererMaterialInspector.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn12DRendererMaterialInspector.cs new file mode 100644 index 00000000..ba3c2eec --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn12DRendererMaterialInspector.cs @@ -0,0 +1,894 @@ +#if UNITY_EDITOR +using System.Linq; +using AllIn1SpriteShader; +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; +using UnityEngine.Rendering; + +namespace AllIn1SpriteShader +{ + [CanEditMultipleObjects] + public class AllIn12DRendererMaterialInspector : ShaderGUI + { + private Material targetMat; + private BlendMode srcMode, dstMode; + private CompareFunction zTestMode = CompareFunction.LessEqual; + private CullMode cullMode; + + private GUIStyle propertiesStyle, bigLabelStyle, smallLabelStyle, toggleButtonStyle; + private const int bigFontSize = 16, smallFontSize = 11; + private string[] oldKeyWords; + private int effectCount = 1; + private Material originalMaterialCopy; + private MaterialEditor matEditor; + private MaterialProperty[] matProperties; + private uint[] materialDrawers = new uint[] { 1, 2, 4, 8 }; + bool[] currEnabledDrawers; + private const uint advancedConfigDrawer = 0; + private const uint colorFxShapeDrawer = 1; + private const uint uvFxShapeDrawer = 2; + private const uint lightingDrawer = 3; + + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) + { + matEditor = materialEditor; + matProperties = properties; + targetMat = materialEditor.target as Material; + effectCount = 1; + oldKeyWords = targetMat.shaderKeywords; + propertiesStyle = new GUIStyle(EditorStyles.helpBox); + propertiesStyle.margin = new RectOffset(0, 0, 0, 0); + bigLabelStyle = new GUIStyle(EditorStyles.boldLabel); + bigLabelStyle.fontSize = bigFontSize; + smallLabelStyle = new GUIStyle(EditorStyles.boldLabel); + smallLabelStyle.fontSize = smallFontSize; + toggleButtonStyle = new GUIStyle(GUI.skin.button) { alignment = TextAnchor.MiddleCenter, richText = true }; + currEnabledDrawers = new bool[materialDrawers.Length]; + uint iniDrawers = (uint)ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue; + for(int i = 0; i < materialDrawers.Length; i++) currEnabledDrawers[i] = (materialDrawers[i] & iniDrawers) > 0; + + GUILayout.Label("General Properties", bigLabelStyle); + DrawProperty(0); + DrawProperty(177); + DrawProperty(1); + DrawProperty(2); + + currEnabledDrawers[advancedConfigDrawer] = GUILayout.Toggle(currEnabledDrawers[advancedConfigDrawer], new GUIContent("Show Advanced Configuration"), toggleButtonStyle); + if(currEnabledDrawers[advancedConfigDrawer]) + { + + EditorGUILayout.BeginVertical(propertiesStyle); + Blending(); + DrawLine(Color.grey, 1, 3); + Culling(); + DrawLine(Color.grey, 1, 3); + ZTest(); + DrawLine(Color.grey, 1, 3); + ZWrite(); + DrawLine(Color.grey, 1, 3); + Billboard("Bilboard active", "BILBOARD_ON"); + DrawLine(Color.grey, 1, 3); + SpriteAtlas("Sprite inside an atlas?", "ATLAS_ON"); + DrawLine(Color.grey, 1, 3); + materialEditor.EnableInstancingField(); + DrawLine(Color.grey, 1, 3); + materialEditor.RenderQueueField(); + EditorGUILayout.EndVertical(); + } + + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Lighting Properties", bigLabelStyle); + currEnabledDrawers[lightingDrawer] = GUILayout.Toggle(currEnabledDrawers[lightingDrawer], new GUIContent("Show Lighting Properties"), toggleButtonStyle); + if(currEnabledDrawers[lightingDrawer]) + { + for (int i = 172; i <= 175; i++) DrawProperty(i); + DrawProperty(176, true); + MaterialProperty glowLight = properties[176]; + if (glowLight.floatValue == 1) targetMat.EnableKeyword("GLOWLIGHT_ON"); + else targetMat.DisableKeyword("GLOWLIGHT_ON"); + } + + EditorGUILayout.Separator(); + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Color Effects", bigLabelStyle); + + currEnabledDrawers[colorFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[colorFxShapeDrawer], new GUIContent("Show Color Effects"), toggleButtonStyle); + if(currEnabledDrawers[colorFxShapeDrawer]) + { + Glow("Glow", "GLOW_ON"); + Fade("Fade", "FADE_ON"); + + Outline("Outline", "OUTBASE_ON"); + GenericEffect("Alpha Outline", "ALPHAOUTLINE_ON", 26, 30, true, "A more performant but less flexible outline"); + InnerOutline("Inner Outline", "INNEROUTLINE_ON", 66, 69); + Gradient("Gradient & Radial Gradient", "GRADIENT_ON"); + GenericEffect("Color Swap", "COLORSWAP_ON", 36, 42, true, "You will need a mask texture (see Documentation)", new int[] { 154 }); + GenericEffect("Hue Shift", "HSV_ON", 43, 45); + ColorChange("Change 1 Color", "CHANGECOLOR_ON"); + ColorRamp("Color Ramp", "COLORRAMP_ON"); + GenericEffect("Hit Effect", "HITEFFECT_ON", 46, 48); + GenericEffect("Negative", "NEGATIVE_ON", 49, 49); + GenericEffect("Pixelate", "PIXELATE_ON", 50, 50, true, "Looks bad with distorition effects"); + GreyScale("GreyScale", "GREYSCALE_ON"); + Posterize("Posterize", "POSTERIZE_ON"); + Blur("Blur", "BLUR_ON"); + GenericEffect("Motion Blur", "MOTIONBLUR_ON", 62, 63); + GenericEffect("Ghost", "GHOST_ON", 64, 65, true, "This effect will not affect the outline", new int[] { 157 }); + GenericEffect("Hologram", "HOLOGRAM_ON", 73, 77, true, null, new int[] { 140, 158 }); + GenericEffect("Chromatic Aberration", "CHROMABERR_ON", 78, 79); + GenericEffect("Glitch", "GLITCH_ON", 80, 80, true, null, new int[] { 139, 184 }); + GenericEffect("Flicker", "FLICKER_ON", 81, 83); + GenericEffect("Shadow", "SHADOW_ON", 84, 87); + GenericEffect("Shine", "SHINE_ON", 133, 138); + GenericEffect("Contrast & Brightness", "CONTRAST_ON", 152, 153); + Overlay("Overlay Texture", "OVERLAY_ON"); + GenericEffect("Alpha Cutoff", "ALPHACUTOFF_ON", 70, 70); + GenericEffect("Alpha Round", "ALPHAROUND_ON", 144, 144); + } + + DrawLine(Color.grey, 1, 3); + GUILayout.Label("UV Effects", bigLabelStyle); + + currEnabledDrawers[uvFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[uvFxShapeDrawer], new GUIContent("Show Alpha Effects"), toggleButtonStyle); + if(currEnabledDrawers[uvFxShapeDrawer]) + { + GenericEffect("Hand Drawn", "DOODLE_ON", 88, 89); + Grass("Grass Movement / Wind", "WIND_ON"); + GenericEffect("Wave", "WAVEUV_ON", 94, 98); + GenericEffect("Round Wave", "ROUNDWAVEUV_ON", 127, 128); + GenericEffect("Rect Size (Enable wireframe to see result)", "RECTSIZE_ON", 99, 99, true, "Only on single sprites spritesheets NOT supported"); + GenericEffect("Offset", "OFFSETUV_ON", 100, 101); + GenericEffect("Clipping / Fill Amount", "CLIPPING_ON", 102, 105); + GenericEffect("Radial Clipping / Radial Fill", "RADIALCLIPPING_ON", 164, 166); + GenericEffect("Texture Scroll", "TEXTURESCROLL_ON", 106, 107, true, "Set Texture Wrap Mode to Repeat"); + GenericEffect("Zoom", "ZOOMUV_ON", 108, 108); + GenericEffect("Distortion", "DISTORT_ON", 109, 112, true, null, new int[] { 182 }); + GenericEffect("Warp Distortion", "WARP_ON", 167, 169); + GenericEffect("Twist", "TWISTUV_ON", 113, 116); + GenericEffect("Rotate", "ROTATEUV_ON", 117, 117, true, "_Tip_ Use Clipping effect to avoid possible undesired parts"); + GenericEffect("Polar Coordinates (Tile texture for good results)", "POLARUV_ON", -1, -1); + GenericEffect("Fish Eye", "FISHEYE_ON", 118, 118); + GenericEffect("Pinch", "PINCH_ON", 119, 119); + GenericEffect("Shake", "SHAKEUV_ON", 120, 122); + } + + SetAndSaveEnabledDrawers(iniDrawers); + } + + private void SetAndSaveEnabledDrawers(uint iniDrawers) + { + uint currDrawers = 0; + for(int i = 0; i < currEnabledDrawers.Length; i++) + { + if(currEnabledDrawers[i]) currDrawers |= materialDrawers[i]; + } + + if(iniDrawers != currDrawers) ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue = currDrawers; + } + + private void Blending() + { + MaterialProperty srcM = ShaderGUI.FindProperty("_MySrcMode", matProperties); + MaterialProperty dstM = ShaderGUI.FindProperty("_MyDstMode", matProperties); + if(srcM.floatValue == 0 && dstM.floatValue == 0) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + } + + GUILayout.Label("Look for 'ShaderLab: Blending' if you don't know what this is", smallLabelStyle); + if(GUILayout.Button("Back To Default Blending")) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + srcMode = (BlendMode)srcM.floatValue; + dstMode = (BlendMode)dstM.floatValue; + srcMode = (BlendMode)EditorGUILayout.EnumPopup("SrcMode", srcMode); + dstMode = (BlendMode)EditorGUILayout.EnumPopup("DstMode", dstMode); + srcM.floatValue = (float)(srcMode); + dstM.floatValue = (float)(dstMode); + + bool ini = oldKeyWords.Contains("PREMULTIPLYALPHA_ON"); + bool toggle = EditorGUILayout.Toggle("Premultiply Alpha?", ini); + if(ini != toggle) Save(); + if(toggle) targetMat.EnableKeyword("PREMULTIPLYALPHA_ON"); + else targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + private void Billboard(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = inspector; + toggle = GUILayout.Toggle(toggle, effectNameLabel); + + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + GUILayout.Label("Don't use this feature on UI elements!", smallLabelStyle); + DrawProperty(129, true); + MaterialProperty billboardY = matProperties[129]; + if(billboardY.floatValue == 1) targetMat.EnableKeyword("BILBOARDY_ON"); + else targetMat.DisableKeyword("BILBOARDY_ON"); + } + else targetMat.DisableKeyword(keyword); + } + + private void ZWrite() + { + MaterialProperty zWrite = ShaderGUI.FindProperty("_ZWrite", matProperties); + bool toggle = zWrite.floatValue > 0.9f ? true : false; + EditorGUILayout.BeginHorizontal(); + { + float tempValue = zWrite.floatValue; + toggle = GUILayout.Toggle(toggle, new GUIContent("Enable Z Write")); + if(toggle) zWrite.floatValue = 1.0f; + else zWrite.floatValue = 0.0f; + if(tempValue != zWrite.floatValue && !Application.isPlaying) Save(); + } + EditorGUILayout.EndHorizontal(); + } + + private void ZTest() + { + MaterialProperty zTestM = ShaderGUI.FindProperty("_ZTestMode", matProperties); + float tempValue = zTestM.floatValue; + zTestMode = (UnityEngine.Rendering.CompareFunction)zTestM.floatValue; + zTestMode = (UnityEngine.Rendering.CompareFunction)EditorGUILayout.EnumPopup("Z TestMode", zTestMode); + zTestM.floatValue = (float)(zTestMode); + if(tempValue != zTestM.floatValue && !Application.isPlaying) Save(); + } + + private void Culling() + { + MaterialProperty cullO = ShaderGUI.FindProperty("_CullingOption", matProperties);; + float tempValue = cullO.floatValue; + cullMode = (UnityEngine.Rendering.CullMode)cullO.floatValue; + cullMode = (UnityEngine.Rendering.CullMode)EditorGUILayout.EnumPopup("Culling Mode", cullMode); + cullO.floatValue = (float)(cullMode); + if(tempValue != cullO.floatValue && !Application.isPlaying) Save(); + } + + private void SpriteAtlas(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + toggle = GUILayout.Toggle(toggle, inspector); + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("Make sure SpriteAtlasUV component is added \n " + + "*Check documentation if unsure what this does or how it works", smallLabelStyle); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + } + + private void Fade(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + ".Fade"; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if (ini != toggle) Save(); + if (toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(7); + DrawProperty(178); + + DrawProperty(8); + DrawProperty(9); + DrawProperty(10); + DrawProperty(11); + + DrawProperty(12); + DrawProperty(179); + + DrawProperty(13); + } + EditorGUILayout.EndVertical(); + } + else + { + targetMat.DisableKeyword(keyword); + } + + EditorGUILayout.EndToggleGroup(); + } + + private void Outline(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + ".Outline"; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("OUTBASE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(14); + DrawProperty(15); + DrawProperty(16); + DrawEffectSubKeywordToggle("Outline High Resolution?", "OUTBASE8DIR_ON"); + + DrawLine(Color.grey, 1, 3); + bool outlinePixelPerf = DrawEffectSubKeywordToggle("Outline is Pixel Perfect?", "OUTBASEPIXELPERF_ON"); + if(outlinePixelPerf) DrawProperty(18); + else DrawProperty(17); + + DrawLine(Color.grey, 1, 3); + bool outlineTexture = DrawEffectSubKeywordToggle("Outline uses texture?", "OUTTEX_ON"); + if(outlineTexture) + { + DrawProperty(19); + DrawProperty(20); + DrawProperty(21); + DrawProperty(180); + } + + DrawLine(Color.grey, 1, 3); + bool outlineDistort = DrawEffectSubKeywordToggle("Outline uses distortion?", "OUTDIST_ON"); + if(outlineDistort) + { + DrawProperty(22); + DrawProperty(23); + DrawProperty(24); + DrawProperty(25); + DrawProperty(181); + } + + DrawLine(Color.grey, 1, 3); + DrawEffectSubKeywordToggle("Only render outline?", "ONLYOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("OUTBASE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GenericEffect(string inspector, string keyword, int first, int last, bool effectCounter = true, string preMessage = null, int[] extraProperties = null, bool boldToggleLetters = true) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + if(effectCounter) + { + effectNameLabel.text = effectCount + "." + inspector; + effectCount++; + } + else effectNameLabel.text = inspector; + if(boldToggleLetters) toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + else toggle = GUILayout.Toggle(toggle, effectNameLabel); + + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + if(preMessage != null) GUILayout.Label(preMessage, smallLabelStyle); + for(int i = first; i <= last; i++) DrawProperty(i); + if(extraProperties != null) + foreach(int i in extraProperties) + DrawProperty(i); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + if(boldToggleLetters) EditorGUILayout.EndToggleGroup(); + } + + private void Glow(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GLOW_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useGlowTex = DrawEffectSubKeywordToggle("Use Glow Texture?", "GLOWTEX_ON"); + if(useGlowTex) DrawProperty(6); + + DrawProperty(3); + DrawProperty(4); + DrawProperty(5, true); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GLOW_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorRamp(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("COLORRAMP_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useEditableGradient = false; + if(AssetDatabase.Contains(targetMat)) + { + useEditableGradient = oldKeyWords.Contains("GRADIENTCOLORRAMP_ON"); + bool gradientTex = useEditableGradient; + gradientTex = GUILayout.Toggle(gradientTex, new GUIContent("Use Editable Gradient?")); + if(useEditableGradient != gradientTex) + { + Save(); + if(gradientTex) + { + useEditableGradient = true; + targetMat.EnableKeyword("GRADIENTCOLORRAMP_ON"); + } + else targetMat.DisableKeyword("GRADIENTCOLORRAMP_ON"); + } + + if(useEditableGradient) matEditor.ShaderProperty(matProperties[159], matProperties[159].displayName); + } + else GUILayout.Label("*Save to folder to allow for dynamic Gradient property", smallLabelStyle); + + if(!useEditableGradient) DrawProperty(51); + + DrawProperty(52); + DrawProperty(53, true); + MaterialProperty colorRampOut = matProperties[53]; + if(colorRampOut.floatValue == 1) targetMat.EnableKeyword("COLORRAMPOUTLINE_ON"); + else targetMat.DisableKeyword("COLORRAMPOUTLINE_ON"); + DrawProperty(155); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("COLORRAMP_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorChange(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("CHANGECOLOR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = 123; i < 127; i++) DrawProperty(i); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR2_ON"); + bool toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 2", ini); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR2_ON"); + for(int i = 146; i < 149; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR2_ON"); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR3_ON"); + toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 3", toggle2); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR3_ON"); + for(int i = 149; i < 152; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR3_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("CHANGECOLOR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GreyScale(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GREYSCALE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(54); + DrawProperty(56); + DrawProperty(55, true); + MaterialProperty greyScaleOut = matProperties[55]; + if(greyScaleOut.floatValue == 1) targetMat.EnableKeyword("GREYSCALEOUTLINE_ON"); + else targetMat.DisableKeyword("GREYSCALEOUTLINE_ON"); + DrawProperty(156); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GREYSCALE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Posterize(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("POSTERIZE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(57); + DrawProperty(58); + DrawProperty(59, true); + MaterialProperty posterizeOut = matProperties[59]; + if(posterizeOut.floatValue == 1) targetMat.EnableKeyword("POSTERIZEOUTLINE_ON"); + else targetMat.DisableKeyword("POSTERIZEOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("POSTERIZE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Blur(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("BLUR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("This effect will not affect the outline", smallLabelStyle); + DrawProperty(60); + DrawProperty(61, true); + MaterialProperty blurIsHd = matProperties[61]; + if(blurIsHd.floatValue == 1) targetMat.EnableKeyword("BLURISHD_ON"); + else targetMat.DisableKeyword("BLURISHD_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("BLUR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Grass(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("WIND_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(90); + DrawProperty(91); + DrawProperty(145); + DrawProperty(92); + DrawProperty(93, true); + MaterialProperty grassManual = matProperties[92]; + if(grassManual.floatValue == 1) targetMat.EnableKeyword("MANUALWIND_ON"); + else targetMat.DisableKeyword("MANUALWIND_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("WIND_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void InnerOutline(string inspector, string keyword, int first, int last) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = first; i <= last; i++) DrawProperty(i); + + EditorGUILayout.Separator(); + DrawProperty(72, true); + MaterialProperty onlyInOutline = matProperties[72]; + if(onlyInOutline.floatValue == 1) targetMat.EnableKeyword("ONLYINNEROUTLINE_ON"); + else targetMat.DisableKeyword("ONLYINNEROUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Gradient(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(143, true); + MaterialProperty gradIsRadial = matProperties[143]; + if(gradIsRadial.floatValue == 1) + { + targetMat.EnableKeyword("RADIALGRADIENT_ON"); + DrawProperty(31); + DrawProperty(32); + DrawProperty(34); + DrawProperty(141); + } + else + { + targetMat.DisableKeyword("RADIALGRADIENT_ON"); + bool simpleGradient = oldKeyWords.Contains("GRADIENT2COL_ON"); + bool simpleGradToggle = EditorGUILayout.Toggle("2 Color Gradient?", simpleGradient); + if(simpleGradient && !simpleGradToggle) targetMat.DisableKeyword("GRADIENT2COL_ON"); + else if(!simpleGradient && simpleGradToggle) targetMat.EnableKeyword("GRADIENT2COL_ON"); + DrawProperty(31); + DrawProperty(32); + if(!simpleGradToggle) DrawProperty(33); + DrawProperty(34); + if(!simpleGradToggle) DrawProperty(35); + if(!simpleGradToggle) DrawProperty(141); + DrawProperty(142); + } + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Overlay(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool multModeOn = oldKeyWords.Contains("OVERLAYMULT_ON"); + bool isMultMode = multModeOn; + isMultMode = GUILayout.Toggle(isMultMode, new GUIContent("Is overlay multiplicative?")); + if(multModeOn != isMultMode) + { + Save(); + if(isMultMode) + { + multModeOn = true; + targetMat.EnableKeyword("OVERLAYMULT_ON"); + } + else targetMat.DisableKeyword("OVERLAYMULT_ON"); + } + + if(multModeOn) GUILayout.Label("Overlay is set to multiplicative mode", smallLabelStyle); + else GUILayout.Label("Overlay is set to additive mode", smallLabelStyle); + + DrawProperty(160); + DrawProperty(183); + DrawProperty(161); + DrawProperty(162); + DrawProperty(163); + + + for(int i = 170; i <= 171; i++) DrawProperty(i); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void DrawProperty(int index, bool noReset = false) + { + MaterialProperty targetProperty = matProperties[index]; + + EditorGUILayout.BeginHorizontal(); + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = targetProperty.displayName; + propertyLabel.tooltip = targetProperty.name + " (C#)"; + + matEditor.ShaderProperty(targetProperty, propertyLabel); + + if(!noReset) + { + GUIContent resetButtonLabel = new GUIContent(); + resetButtonLabel.text = "R"; + resetButtonLabel.tooltip = "Resets to default value"; + if(GUILayout.Button(resetButtonLabel, GUILayout.Width(20))) ResetProperty(targetProperty); + } + } + EditorGUILayout.EndHorizontal(); + } + + private void ResetProperty(MaterialProperty targetProperty) + { + AllIn1ShaderPropertyType propertyType = EditorUtils.GetShaderTypeByMaterialProperty(targetProperty); + + if(originalMaterialCopy == null) originalMaterialCopy = new Material(targetMat.shader); + if(propertyType == AllIn1ShaderPropertyType.Float || propertyType == AllIn1ShaderPropertyType.Range) + { + targetProperty.floatValue = originalMaterialCopy.GetFloat(targetProperty.name); + } + else if(propertyType == AllIn1ShaderPropertyType.Vector) + { + targetProperty.vectorValue = originalMaterialCopy.GetVector(targetProperty.name); + } + else if(propertyType == AllIn1ShaderPropertyType.Color) + { + targetProperty.colorValue = originalMaterialCopy.GetColor(targetProperty.name); + } + else if(propertyType == AllIn1ShaderPropertyType.Texture) + { + targetProperty.textureValue = originalMaterialCopy.GetTexture(targetProperty.name); + } + } + + private bool DrawEffectSubKeywordToggle(string inspector, string keyword, bool setCustomConfigAfter = false) + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = inspector; + propertyLabel.tooltip = keyword + " (C#)"; + + bool ini = oldKeyWords.Contains(keyword); + bool toggle = ini; + toggle = GUILayout.Toggle(toggle, propertyLabel); + if(ini != toggle) + { + if(toggle) targetMat.EnableKeyword(keyword); + else targetMat.DisableKeyword(keyword); + } + + return toggle; + } + + private void Save() + { + if(!Application.isPlaying) EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + EditorUtility.SetDirty(targetMat); + } + + private void DrawLine(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + r.height = thickness; + r.y += (padding / 2); + r.x -= 2; + r.width += 6; + EditorGUI.DrawRect(r, color); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn12DRendererMaterialInspector.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn12DRendererMaterialInspector.cs.meta new file mode 100644 index 00000000..8261b853 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn12DRendererMaterialInspector.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: e063793833d64b7439fd1f34dc70b052 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn12DRendererMaterialInspector.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderAssetPostProcessor.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderAssetPostProcessor.cs new file mode 100644 index 00000000..6ae0a261 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderAssetPostProcessor.cs @@ -0,0 +1,26 @@ +#if UNITY_EDITOR +using UnityEditor; + +namespace AllIn1SpriteShader +{ + public class AllIn1ShaderAssetPostProcessor : AssetPostprocessor + { + static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths, bool didDomainReload) + { + bool needToRefreshConfig = false; + for (int i = 0; i < importedAssets.Length; i++) + { + if (importedAssets[i].EndsWith(Constants.MAIN_ASSEMBLY_NAME)) + { + needToRefreshConfig = needToRefreshConfig || true; + } + } + + if (needToRefreshConfig) + { + AllIn1ShaderImporter.ForceReimport(); + } + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderAssetPostProcessor.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderAssetPostProcessor.cs.meta new file mode 100644 index 00000000..67705533 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderAssetPostProcessor.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 9ab4f76bf224f2b4d8735f59db902c37 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderAssetPostProcessor.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs new file mode 100644 index 00000000..0f49833e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs @@ -0,0 +1,283 @@ +#if UNITY_EDITOR +using System; +using System.Linq; +using System.Reflection; +using UnityEditor; +using UnityEngine; +using Object = UnityEngine.Object; + +namespace AllIn1SpriteShader +{ + public class AllIn1ShaderGradientDrawer : MaterialPropertyDrawer + { + private int resolution; + private Texture2D textureAsset; + private static MethodInfo reinitializeMethod; + private static MethodInfo resizeMethod; + + public AllIn1ShaderGradientDrawer() + { + resolution = 64; + } + + public AllIn1ShaderGradientDrawer(float res) + { + resolution = (int)res; + } + + private static bool IsPropertyTypeSuitable(MaterialProperty prop) + { + AllIn1ShaderPropertyType propertyType = EditorUtils.GetShaderTypeByMaterialProperty(prop); + return propertyType == AllIn1ShaderPropertyType.Texture; + } + + private string TextureName(MaterialProperty prop) => $"z{prop.name}Tex"; + private string OldName(MaterialProperty prop) => $"{prop.name}Tex"; + + public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + if (!IsPropertyTypeSuitable(prop)) + { + EditorGUI.HelpBox(position, $"[Gradient] used on non-texture property \"{prop.name}\"", MessageType.Error); + return; + } + + if (!AssetDatabase.Contains(prop.targets.FirstOrDefault())) + { + EditorGUI.HelpBox(position, "Save Material To Folder to use this effect. Or use the regular Color Ramp instead", MessageType.Error); + return; + } + + string textureName = TextureName(prop); + string oldTextureName = OldName(prop); + + Gradient currentGradient = null; + if (prop.targets.Length == 1) + { + Material target = (Material)prop.targets[0]; + string path = AssetDatabase.GetAssetPath(target); + textureAsset = GetTexture(path, textureName, oldTextureName); + if (textureAsset != null) currentGradient = DecodeGradient(prop, textureAsset.name); + if (currentGradient == null) currentGradient = new Gradient() { }; + + EditorGUI.showMixedValue = false; + } + else + { + EditorGUI.showMixedValue = true; + } + + using (EditorGUI.ChangeCheckScope changeScope = new EditorGUI.ChangeCheckScope()) + { + currentGradient = EditorGUILayout.GradientField(label, currentGradient, GUILayout.Height(15)); + + if (changeScope.changed) + { + string encodedGradient = EncodeGradient(currentGradient); + string fullAssetName = textureName + encodedGradient; + foreach (Object target in prop.targets) + { + if (!AssetDatabase.Contains(target)) continue; + + string path = AssetDatabase.GetAssetPath(target); + Texture2D textureAsset = GetTexture(path, textureName, oldTextureName); + Undo.RecordObject(textureAsset, "Change Material Gradient"); + textureAsset.name = fullAssetName; + BakeGradient(currentGradient, textureAsset); + EditorUtility.SetDirty(textureAsset); + + Material material = (Material)target; + material.SetTexture(prop.name, textureAsset); + } + } + } + EditorGUI.showMixedValue = false; + } + + private Texture2D GetTexture(string path, string name, string possibleOldName) + { + textureAsset = GetTextureAsset(path, name); + if(textureAsset == null) + { + textureAsset = GetTextureAsset(path, possibleOldName); + if(textureAsset != null) + { + textureAsset.name = textureAsset.name.Replace(possibleOldName, name); + EditorUtility.SetDirty(textureAsset); + } + } + if (textureAsset == null) CreateTexture(path, name); + if(textureAsset.width != resolution) + { + ResizeTexture(textureAsset, resolution, 1); + EditorUtility.SetDirty(textureAsset); + AssetDatabase.SaveAssets(); + } + return textureAsset; + } + + private void ResizeTexture(Texture2D texture, int width, int height) + { + if(reinitializeMethod == null && resizeMethod == null) + { + reinitializeMethod = typeof(Texture2D).GetMethod("Reinitialize", new[] { typeof(int), typeof(int) }); + if(reinitializeMethod == null) resizeMethod = typeof(Texture2D).GetMethod("Resize", new[] { typeof(int), typeof(int) }); + } + + if(reinitializeMethod != null) reinitializeMethod.Invoke(texture, new object[] { width, height }); + else if(resizeMethod != null) resizeMethod.Invoke(texture, new object[] { width, height }); + } + + private void CreateTexture(string path, string name = "unnamed texture") + { + textureAsset = new Texture2D(resolution, 1, TextureFormat.RGBA32, false); + textureAsset.wrapMode = TextureWrapMode.Clamp; + textureAsset.filterMode = FilterMode.Bilinear; + textureAsset.name = name; + AssetDatabase.AddObjectToAsset(textureAsset, path); + AssetDatabase.Refresh(); + } + + private string EncodeGradient(Gradient gradient) + { + if (gradient == null) return null; + return JsonUtility.ToJson(new GradientRepresentation(gradient)); + } + + private Gradient DecodeGradient(MaterialProperty prop, string name) + { + string json = name.Substring(TextureName(prop).Length); + try + { + return JsonUtility.FromJson(json).ToGradient(); + } + catch (Exception) + { + return null; + } + } + + private Texture2D GetTextureAsset(string path, string name) + { + return AssetDatabase.LoadAllAssetsAtPath(path).FirstOrDefault(asset => asset.name.StartsWith(name)) as Texture2D; + } + + private void BakeGradient(Gradient gradient, Texture2D texture) + { + if (gradient == null) return; + for (int x = 0; x < texture.width; x++) + { + Color color = gradient.Evaluate((float)x / (texture.width - 1)); + for (int y = 0; y < texture.height; y++) texture.SetPixel(x, y, color); + } + texture.Apply(); + } + + [MenuItem("Assets/AllIn1Shader Gradients/Remove All Gradient Textures")] + static void RemoveAllSubassets() + { + foreach(Object asset in Selection.GetFiltered(SelectionMode.Assets)) + { + string path = AssetDatabase.GetAssetPath(asset); + AssetDatabase.ImportAsset(path); + foreach(Object subAsset in AssetDatabase.LoadAllAssetRepresentationsAtPath(path)) + { + Object.DestroyImmediate(subAsset, true); + } + AssetDatabase.ImportAsset(path); + } + } + + class GradientRepresentation + { + public GradientMode mode; + public ColorKey[] colorKeys; + public AlphaKey[] alphaKeys; + + public GradientRepresentation() { } + + public GradientRepresentation(Gradient source) + { + FromGradient(source); + } + + private void FromGradient(Gradient source) + { + mode = source.mode; + colorKeys = source.colorKeys.Select(key => new ColorKey(key)).ToArray(); + alphaKeys = source.alphaKeys.Select(key => new AlphaKey(key)).ToArray(); + } + + private void ToGradient(Gradient gradient) + { + gradient.mode = mode; + gradient.colorKeys = colorKeys.Select(key => key.ToGradientKey()).ToArray(); + gradient.alphaKeys = alphaKeys.Select(key => key.ToGradientKey()).ToArray(); + } + + public Gradient ToGradient() + { + Gradient gradient = new Gradient(); + ToGradient(gradient); + return gradient; + } + + [Serializable] + public struct ColorKey + { + public Color color; + public float time; + + public ColorKey(GradientColorKey source) + { + color = default; + time = default; + FromGradientKey(source); + } + + public void FromGradientKey(GradientColorKey source) + { + color = source.color; + time = source.time; + } + + public GradientColorKey ToGradientKey() + { + GradientColorKey key; + key.color = color; + key.time = time; + return key; + } + } + + [Serializable] + public struct AlphaKey + { + public float alpha; + public float time; + + public AlphaKey(GradientAlphaKey source) + { + alpha = default; + time = default; + FromGradientKey(source); + } + + public void FromGradientKey(GradientAlphaKey source) + { + alpha = source.alpha; + time = source.time; + } + + public GradientAlphaKey ToGradientKey() + { + GradientAlphaKey key; + key.alpha = alpha; + key.time = time; + return key; + } + } + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs.meta new file mode 100644 index 00000000..f4de595e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: c51263ea47edd3641a26e5f242925bcf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderGradientDrawer.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs new file mode 100644 index 00000000..881c6073 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs @@ -0,0 +1,221 @@ +#if UNITY_EDITOR +using System; +using System.IO; +using UnityEditor; +using UnityEngine; + +namespace AllIn1SpriteShader +{ + [InitializeOnLoad] + public static class AllIn1ShaderImporter + { + public enum UnityVersion + { + NONE = 0, + UNITY_2019 = 1, + UNITY_2020 = 2, + UNITY_2021 = 3, + UNITY_2022 = 4, + UNITY_6 = 5, + } + + public enum RenderPipeline + { + NONE = -1, + BIRP = 0, + URP = 1, + HDRP = 2, + } + + + private const string SHADER_FOLDER_PATH = "../../Shaders/LitShaders"; + private const string FINAL_SHADERS_FOLDER_PATH = "../../Shaders"; + private const string SHADER_TEMPLATE_NAME = @"{0}_{1}.txt"; + + private const string SPRITE_LIT_SHADER_NAME = "AllIn1SpriteShaderLit"; + private const string SPRITE_LIT_TRANSPARENT_SHADER_NAME = "AllIn1SpriteShaderLitTransparent"; + + private const string PIPELINE_SUFFIX_URP_2019 = "BetterShader_URP2019"; + private const string PIPELINE_SUFFIX_HDRP_2019 = "BetterShader_HDRP2019"; + + private const string PIPELINE_SUFFIX_URP_2020 = "BetterShader_URP2020"; + private const string PIPELINE_SUFFIX_HDRP_2020 = "BetterShader_HDRP2020"; + + private const string PIPELINE_SUFFIX_URP_2021 = "BetterShader_URP2021"; + private const string PIPELINE_SUFFIX_HDRP_2021 = "BetterShader_HDRP2021"; + + private const string PIPELINE_SUFFIX_URP_2022 = "BetterShader_URP2022"; + private const string PIPELINE_SUFFIX_HDRP_2022 = "BetterShader_HDRP2022"; + + private const string PIPELINE_SUFFIX_URP_2023 = "BetterShader_URP2023"; + private const string PIPELINE_SUFFIX_HDRP_2023 = "BetterShader_HDRP2023"; + + private const string PIPELINE_SUFFIX_STANDARD = "BetterShader_Standard"; + + private const string LIT_SHADER_PIPELINE_KEY = "AllIn1SpriteShader_LitShader_RenderPipeline"; + private const string LIT_SHADER_UNITY_VERSION_KEY = "AllIn1SpriteShader_LitShader_UnityVersion"; + private const string LIT_SHADER_FIRST_TIME_PROJECT = "AllIn1SpriteShader_LitShader_FirstTimeProject"; + + static AllIn1ShaderImporter() + { + ConfigureShaders(); + } + + private static void ConfigureShaders() + { + RenderPipelineChecker.RefreshData(); + + UnityVersion unityVersion = GetUnityVersion(); + RenderPipeline renderPipeline = GetRenderPipeline(); + + RenderPipeline lastRenderPipeline = (RenderPipeline)SessionState.GetInt(LIT_SHADER_PIPELINE_KEY, -1); + UnityVersion lastUnityVersion = (UnityVersion)SessionState.GetInt(LIT_SHADER_UNITY_VERSION_KEY, 0); + int firstTimeProject = SessionState.GetInt(LIT_SHADER_FIRST_TIME_PROJECT, -1); + + if (lastRenderPipeline != renderPipeline || lastUnityVersion != unityVersion || firstTimeProject != 1) + { + SessionState.SetInt(LIT_SHADER_PIPELINE_KEY, (int)renderPipeline); + SessionState.SetInt(LIT_SHADER_UNITY_VERSION_KEY, (int)unityVersion); + SessionState.SetInt(LIT_SHADER_FIRST_TIME_PROJECT, 1); + + ConfigureShader(SPRITE_LIT_SHADER_NAME); + ConfigureShader(SPRITE_LIT_TRANSPARENT_SHADER_NAME); + } + } + + private static void ConfigureShader(string shaderName) + { + string pipelineSufix = string.Empty; + + UnityVersion unityVersion = GetUnityVersion(); + RenderPipeline renderPipeline = GetRenderPipeline(); + + if (renderPipeline == RenderPipeline.HDRP) + { + switch (unityVersion) + { + case UnityVersion.UNITY_2019: + pipelineSufix = PIPELINE_SUFFIX_HDRP_2019; + break; + case UnityVersion.UNITY_2020: + pipelineSufix = PIPELINE_SUFFIX_HDRP_2020; + break; + case UnityVersion.UNITY_2021: + pipelineSufix = PIPELINE_SUFFIX_HDRP_2021; + break; + case UnityVersion.UNITY_2022: + pipelineSufix = PIPELINE_SUFFIX_HDRP_2022; + break; + case UnityVersion.UNITY_6: + pipelineSufix = PIPELINE_SUFFIX_HDRP_2023; + break; + + } + } + else if (renderPipeline == RenderPipeline.URP) + { + switch (unityVersion) + { + case UnityVersion.UNITY_2019: + pipelineSufix = PIPELINE_SUFFIX_URP_2019; + break; + case UnityVersion.UNITY_2020: + pipelineSufix = PIPELINE_SUFFIX_URP_2020; + break; + case UnityVersion.UNITY_2021: + pipelineSufix = PIPELINE_SUFFIX_URP_2021; + break; + case UnityVersion.UNITY_2022: + pipelineSufix = PIPELINE_SUFFIX_URP_2022; + break; + case UnityVersion.UNITY_6: + pipelineSufix = PIPELINE_SUFFIX_URP_2023; + break; + } + } + else + { + pipelineSufix = PIPELINE_SUFFIX_STANDARD; + } + + string templateFileName = string.Format(SHADER_TEMPLATE_NAME, shaderName, pipelineSufix); + + string shaderTemplatePath = SHADER_FOLDER_PATH + "/" + templateFileName; + string finalShaderPath = FINAL_SHADERS_FOLDER_PATH + "/" + $"{shaderName}.shader"; + + try + { + var currentFileGUID = AssetDatabase.FindAssets($"t:Script {nameof(AllIn1ShaderImporter)}")[0]; + string currentFolder = Path.GetDirectoryName(AssetDatabase.GUIDToAssetPath(currentFileGUID)); + + string newShaderStr = File.ReadAllText(Path.Combine(currentFolder, shaderTemplatePath)); + newShaderStr = newShaderStr.Replace($"Shader \"AllIn1SpriteShader/{shaderName}_BetterShader\"", $"Shader \"AllIn1SpriteShader/{shaderName}\""); + + File.WriteAllText(Path.Combine(currentFolder, finalShaderPath), EditorUtils.UnifyEOL(newShaderStr)); + + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + } + catch (Exception e) + { + Debug.LogError("Shader not found: " + e); + } + } + + private static UnityVersion GetUnityVersion() + { + UnityVersion res = UnityVersion.NONE; + + string unityVersion = Application.unityVersion; + + if (unityVersion.Contains("2019")) + { + res = UnityVersion.UNITY_2019; + } + else if (unityVersion.Contains("2020")) + { + res = UnityVersion.UNITY_2020; + } + else if (unityVersion.Contains("2021")) + { + res = UnityVersion.UNITY_2021; + } + else if (unityVersion.Contains("2022")) + { + res = UnityVersion.UNITY_2022; + } + else if (unityVersion.Contains("6000")) + { + res = UnityVersion.UNITY_6; + } + + return res; + } + + private static RenderPipeline GetRenderPipeline() + { + RenderPipeline res = RenderPipeline.BIRP; + + if (RenderPipelineChecker.IsURP) + { + res = RenderPipeline.URP; + } + else if (RenderPipelineChecker.IsHDRP) + { + res = RenderPipeline.HDRP; + } + + return res; + } + + public static void ForceReimport() + { + SessionState.EraseInt(LIT_SHADER_PIPELINE_KEY); + SessionState.EraseInt(LIT_SHADER_UNITY_VERSION_KEY); + SessionState.EraseInt(LIT_SHADER_FIRST_TIME_PROJECT); + + ConfigureShaders(); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs.meta new file mode 100644 index 00000000..786f7cbe --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: aa9d501412652444c8b5b573248c31be +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderImporter.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderPropertyType.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderPropertyType.cs new file mode 100644 index 00000000..767b43b1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderPropertyType.cs @@ -0,0 +1,12 @@ +namespace AllIn1SpriteShader +{ + public enum AllIn1ShaderPropertyType + { + Color, + Vector, + Float, + Range, + Texture, + Int, + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderPropertyType.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderPropertyType.cs.meta new file mode 100644 index 00000000..72033b11 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderPropertyType.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 292320b1088d1734184f5459f884be05 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderPropertyType.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs new file mode 100644 index 00000000..0293ebfa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs @@ -0,0 +1,327 @@ +#if UNITY_EDITOR +using UnityEditor; +using UnityEngine; +using UnityEngine.UI; +using ShaderType = AllIn1SpriteShader.AllIn1Shader.ShaderTypes; + +namespace AllIn1SpriteShader +{ + [CustomEditor(typeof(AllIn1Shader)), CanEditMultipleObjects] + public class AllIn1ShaderScriptEditor : UnityEditor.Editor + { + private bool showUrpWarning = false; + private double warningTime = 0f; + private SerializedProperty m_NormalStrength, m_NormalSmoothing; + private Texture2D imageInspector; + + private enum ImageType + { + ShowImage, + HideInComponent, + HideEverywhere + } + private ImageType imageType; + + private void OnEnable() + { + m_NormalStrength = serializedObject.FindProperty("normalStrength"); + m_NormalSmoothing = serializedObject.FindProperty("normalSmoothing"); + } + + public override void OnInspectorGUI() + { + ChooseAndDisplayAssetImage(); + + AllIn1Shader myScript = (AllIn1Shader)target; + + SetCurrentShaderType(myScript); + + if (GUILayout.Button("Deactivate All Effects")) + { + for (int i = 0; i < targets.Length; i++) ((AllIn1Shader)targets[i]).ClearAllKeywords(); + AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Deactivated All Effects"); + } + + if (GUILayout.Button("New Clean Material")) + { + bool successOperation = true; + for (int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader)targets[i]).TryCreateNew(); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Clean Material"); + } + + + if (GUILayout.Button("Create New Material With Same Properties (SEE DOC)")) + { + bool successOperation = true; + for (int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader)targets[i]).MakeCopy(); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Copy Created"); + } + + if (GUILayout.Button("Save Material To Folder (SEE DOC)")) + { + bool successOperation = true; + for(int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader) targets[i]).SaveMaterial(); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Material Saved"); + } + + if (GUILayout.Button("Apply Material To All Children")) + { + bool successOperation = true; + for(int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader) targets[i]).ApplyMaterialToHierarchy(); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Material Applied To Children"); + else EditorUtility.DisplayDialog("No children found", "All In 1 Shader component couldn't find any children to this GameObject (" + targets[0].name + ")", "Ok"); + } + + if (myScript.currentShaderType != AllIn1Shader.ShaderTypes.Urp2dRenderer) + { + if (GUILayout.Button("Render Material To Image")) + { + bool successOperation = true; + for(int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader) targets[i]).RenderToImage(); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Material Rendered To Image"); + } + } + + bool isUrp = false; + Shader temp = AllIn1ShaderWindow.FindShader("AllIn1Urp2dRenderer"); + if (temp != null) isUrp = true; + EditorGUILayout.BeginHorizontal(); + { + GUILayout.Label("Change Shader Variant:", GUILayout.MaxWidth(140)); + int previousShaderType = (int)myScript.currentShaderType; + myScript.currentShaderType = (AllIn1Shader.ShaderTypes)EditorGUILayout.EnumPopup(myScript.currentShaderType); + if (previousShaderType != (int)myScript.currentShaderType) + { + for (int i = 0; i < targets.Length; i++) ((AllIn1Shader)targets[i]).CheckIfValidTarget(); + if (myScript == null) return; + if (isUrp || myScript.currentShaderType != AllIn1Shader.ShaderTypes.Urp2dRenderer) + { + AllIn1ShaderWindow.SceneViewNotificationAndLog(myScript.gameObject.name + " shader variant has been changed to: " + myScript.currentShaderType); + myScript.SetSceneDirty(); + + Renderer sr = myScript.GetComponent(); + if (sr != null) + { + if (sr.sharedMaterial != null) + { + int renderingQueue = sr.sharedMaterial.renderQueue; + if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Default) sr.sharedMaterial.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShader"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.ScaledTime) sr.sharedMaterial.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderScaledTime"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.MaskedUI) sr.sharedMaterial.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderUiMask"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Urp2dRenderer) sr.sharedMaterial.shader = AllIn1ShaderWindow.FindShader("AllIn1Urp2dRenderer"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Lit) sr.sharedMaterial.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderLit"); + else if(myScript.currentShaderType == AllIn1Shader.ShaderTypes.SRPBatcher) sr.sharedMaterial.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderSRPBatch"); + else SetCurrentShaderType(myScript); + sr.sharedMaterial.renderQueue = renderingQueue; + + if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Lit) + { + sr.sharedMaterial.SetFloat("_ZWrite", 1.0f); + sr.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On; + sr.receiveShadows = true; + sr.sharedMaterial.renderQueue = 2000; + } + else + { + sr.sharedMaterial.SetFloat("_ZWrite", 0f); + sr.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; + sr.receiveShadows = false; + sr.sharedMaterial.renderQueue = 3000; + } + } + } + else + { + Graphic img = myScript.GetComponent(); + if (img != null && img.material != null) + { + int renderingQueue = img.material.renderQueue; + if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Default) img.material.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShader"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.ScaledTime) img.material.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderScaledTime"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.MaskedUI) img.material.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderUiMask"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Urp2dRenderer) img.material.shader = AllIn1ShaderWindow.FindShader("AllIn1Urp2dRenderer"); + else if (myScript.currentShaderType == AllIn1Shader.ShaderTypes.Lit) img.material.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderLit"); + else if(myScript.currentShaderType == AllIn1Shader.ShaderTypes.SRPBatcher) img.material.shader = AllIn1ShaderWindow.FindShader("AllIn1SpriteShaderSRPBatch"); + else SetCurrentShaderType(myScript); + img.material.renderQueue = renderingQueue; + } + } + } + else if(!isUrp && myScript.currentShaderType == AllIn1Shader.ShaderTypes.Urp2dRenderer) + { + myScript.currentShaderType = (AllIn1Shader.ShaderTypes) previousShaderType; + showUrpWarning = true; + warningTime = EditorApplication.timeSinceStartup + 5; + } + } + } + EditorGUILayout.EndHorizontal(); + + if (warningTime < EditorApplication.timeSinceStartup) showUrpWarning = false; + if (isUrp) showUrpWarning = false; + if (showUrpWarning) EditorGUILayout.HelpBox( + "You can't set the URP 2D Renderer variant since you didn't import the URP package available in the asset root folder (SEE DOCUMENTATION)", + MessageType.Error, + true); + + if ((isUrp && myScript.currentShaderType == AllIn1Shader.ShaderTypes.Urp2dRenderer) || myScript.currentShaderType == AllIn1Shader.ShaderTypes.Lit) + { + EditorGUILayout.Space(); + DrawLine(Color.grey, 1, 3); + EditorGUILayout.Space(); + + if (GUILayout.Button("Create And Add Normal Map")) + { + for (int i = 0; i < targets.Length; i++) ((AllIn1Shader)targets[i]).CreateAndAssignNormalMap(); + AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Creating Normal Map"); + + } + serializedObject.Update(); + EditorGUILayout.PropertyField(m_NormalStrength, new GUIContent("Normal Strength"), GUILayout.Height(20)); + EditorGUILayout.PropertyField(m_NormalSmoothing, new GUIContent("Normal Blur"), GUILayout.Height(20)); + if (myScript.computingNormal) + { + EditorGUILayout.LabelField("Normal Map is currently being created, be patient", EditorStyles.boldLabel, GUILayout.Height(40)); + } + serializedObject.ApplyModifiedProperties(); + + EditorGUILayout.Space(); + } + + DrawLine(Color.grey, 1, 3); + EditorGUILayout.Space(); + + if (GUILayout.Button("Sprite Atlas Auto Setup")) + { + bool successOperation = true; + for(int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader) targets[i]).ToggleSetAtlasUvs(true); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Sprite Atlas Auto Setup"); + } + if (GUILayout.Button("Remove Sprite Atlas Configuration")) + { + bool successOperation = true; + for(int i = 0; i < targets.Length; i++) + { + successOperation &= ((AllIn1Shader) targets[i]).ToggleSetAtlasUvs(false); + } + if(successOperation) AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Remove Sprite Atlas Configuration"); + } + +#if LETAI_TRUESHADOW + if (myScript.GetComponent() && !myScript.GetComponent()) + { + EditorGUILayout.Space(); + DrawLine(Color.grey, 1, 3); + if (GUILayout.Button("Add True Shadow Compatibility")) + { + myScript.gameObject.AddComponent(); + myScript.SetSceneDirty(); + } + } +#endif + + EditorGUILayout.Space(); + DrawLine(Color.grey, 1, 3); + + if(GUILayout.Button("Remove Component")) + { + for(int i = targets.Length - 1; i >= 0; i--) + { + DestroyImmediate(targets[i] as AllIn1Shader); + ((AllIn1Shader)targets[i]).SetSceneDirty(); + } + AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Component Removed"); + } + + if (GUILayout.Button("REMOVE COMPONENT AND MATERIAL")) + { + for (int i = 0; i < targets.Length; i++) + { + ((AllIn1Shader)targets[i]).CleanMaterial(); + } + for (int i = targets.Length - 1; i >= 0; i--) + { + DestroyImmediate(targets[i] as AllIn1Shader); + } + AllIn1ShaderWindow.ShowSceneViewNotification("AllIn1SpriteShader: Component And Material Removed"); + } + } + + private void ChooseAndDisplayAssetImage() + { + if(!EditorPrefs.HasKey("allIn1ImageConfig")) + { + EditorPrefs.SetInt("allIn1ImageConfig", (int) ImageType.ShowImage); + } + + imageType = (ImageType) EditorPrefs.GetInt("allIn1ImageConfig"); + switch(imageType) + { + case ImageType.ShowImage: + case ImageType.HideInComponent: + if(imageInspector == null) imageInspector = AllIn1ShaderWindow.GetInspectorImage(); + break; + } + + if(imageInspector && imageType != ImageType.HideInComponent && imageType != ImageType.HideEverywhere && imageInspector) + { + Rect rect = EditorGUILayout.GetControlRect(GUILayout.Height(40)); + GUI.DrawTexture(rect, imageInspector, ScaleMode.ScaleToFit, true); + } + } + + private void SetCurrentShaderType(AllIn1Shader myScript) + { + string shaderName = ""; + Renderer sr = myScript.GetComponent(); + if (sr != null) + { + if(sr.sharedMaterial == null) return; + shaderName = sr.sharedMaterial.shader.name; + } + else + { + Graphic img = myScript.GetComponent(); + if(img.material == null) return; + if (img != null) shaderName = img.material.shader.name; + } + shaderName = shaderName.Replace("AllIn1SpriteShader/", ""); + + if (shaderName.Equals("AllIn1SpriteShader")) myScript.currentShaderType = AllIn1Shader.ShaderTypes.Default; + else if (shaderName.Equals("AllIn1SpriteShaderScaledTime")) myScript.currentShaderType = AllIn1Shader.ShaderTypes.ScaledTime; + else if (shaderName.Equals("AllIn1SpriteShaderUiMask")) myScript.currentShaderType = AllIn1Shader.ShaderTypes.MaskedUI; + else if (shaderName.Equals("AllIn1Urp2dRenderer")) myScript.currentShaderType = AllIn1Shader.ShaderTypes.Urp2dRenderer; + else if(shaderName.Equals("AllIn1SpriteShaderLit")) myScript.currentShaderType = AllIn1Shader.ShaderTypes.Lit; + else if(shaderName.Equals("AllIn1SpriteShaderSRPBatch")) myScript.currentShaderType = AllIn1Shader.ShaderTypes.SRPBatcher; + } + + private void DrawLine(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + r.height = thickness; + r.y += (padding / 2); + r.x -= 2; + r.width += 6; + EditorGUI.DrawRect(r, color); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs.meta new file mode 100644 index 00000000..c3b890ba --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 78232fc1cf0e9c445a36b7bf7fc49fdb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1ShaderScriptEditor.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs new file mode 100644 index 00000000..f000ec55 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs @@ -0,0 +1,850 @@ +#if UNITY_EDITOR +using AllIn1SpriteShader; +using System.Linq; +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; +using UnityEngine.Rendering; + +namespace AllIn1SpriteShader +{ + [CanEditMultipleObjects] + public class AllIn1SpriteShaderLitMaterialInspector : ShaderGUI + { + private Material targetMat; + private BlendMode srcMode, dstMode; + private CompareFunction zTestMode = CompareFunction.LessEqual; + private CullMode cullMode; + + private GUIStyle propertiesStyle, bigLabelStyle, smallLabelStyle, toggleButtonStyle; + private const int bigFontSize = 16, smallFontSize = 11; + private string[] oldKeyWords; + private int effectCount = 1; + private Material originalMaterialCopy; + private MaterialEditor matEditor; + private MaterialProperty[] matProperties; + private uint[] materialDrawers = new uint[] { 1, 2, 4 }; + bool[] currEnabledDrawers; + private const uint advancedConfigDrawer = 0; + private const uint colorFxShapeDrawer = 1; + private const uint uvFxShapeDrawer = 2; + + + + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) + { + matEditor = materialEditor; + matProperties = properties; + targetMat = materialEditor.target as Material; + effectCount = 1; + oldKeyWords = targetMat.shaderKeywords; + propertiesStyle = new GUIStyle(EditorStyles.helpBox); + propertiesStyle.margin = new RectOffset(0, 0, 0, 0); + bigLabelStyle = new GUIStyle(EditorStyles.boldLabel); + bigLabelStyle.fontSize = bigFontSize; + smallLabelStyle = new GUIStyle(EditorStyles.boldLabel); + smallLabelStyle.fontSize = smallFontSize; + toggleButtonStyle = new GUIStyle(GUI.skin.button) { alignment = TextAnchor.MiddleCenter, richText = true }; + currEnabledDrawers = new bool[materialDrawers.Length]; + uint iniDrawers = (uint)ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue; + for(int i = 0; i < materialDrawers.Length; i++) currEnabledDrawers[i] = (materialDrawers[i] & iniDrawers) > 0; + + GUILayout.Label("General Properties", bigLabelStyle); + DrawProperty(0); + DrawProperty(172); + + DrawProperty(1); + //DrawProperty(2); + DrawProperty(70); + + currEnabledDrawers[advancedConfigDrawer] = GUILayout.Toggle(currEnabledDrawers[advancedConfigDrawer], new GUIContent("Show Advanced Configuration"), toggleButtonStyle); + if(currEnabledDrawers[advancedConfigDrawer]) + { + + EditorGUILayout.BeginVertical(propertiesStyle); + Culling(); + DrawLine(Color.grey, 1, 3); + ZTest(); + DrawLine(Color.grey, 1, 3); + ZWrite(); + DrawLine(Color.grey, 1, 3); + Billboard("Billboard active", "BILBOARD_ON"); + DrawLine(Color.grey, 1, 3); + SpriteAtlas("Sprite inside an atlas?", "ATLAS_ON"); + DrawLine(Color.grey, 1, 3); + materialEditor.EnableInstancingField(); + DrawLine(Color.grey, 1, 3); + materialEditor.RenderQueueField(); + EditorGUILayout.EndVertical(); + } + + EditorGUILayout.Separator(); + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Light Effect", bigLabelStyle); + GenericEffect("Normal Map", "NORMALMAP_ON", 189, 190); + + EditorGUILayout.Separator(); + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Color Effects", bigLabelStyle); + + currEnabledDrawers[colorFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[colorFxShapeDrawer], new GUIContent("Show Color Effects"), toggleButtonStyle); + if(currEnabledDrawers[colorFxShapeDrawer]) + { + Glow("Glow", "GLOW_ON"); + GenericEffect("Fade", "FADE_ON", 7, 13, extraProperties: new int[] { 173, 174 } ); + Outline("Outline", "OUTBASE_ON"); + GenericEffect("Alpha Outline", "ALPHAOUTLINE_ON", 26, 30, true, "A more performant but less flexible outline"); + InnerOutline("Inner Outline", "INNEROUTLINE_ON", 66, 69); + Gradient("Gradient & Radial Gradient", "GRADIENT_ON"); + GenericEffect("Color Swap", "COLORSWAP_ON", 36, 42, true, "You will need a mask texture (see Documentation)", new int[] { 154 }); + GenericEffect("Hue Shift", "HSV_ON", 43, 45); + ColorChange("Change 1 Color", "CHANGECOLOR_ON"); + ColorRamp("Color Ramp", "COLORRAMP_ON"); + GenericEffect("Hit Effect", "HITEFFECT_ON", 46, 48); + GenericEffect("Negative", "NEGATIVE_ON", 49, 49); + GenericEffect("Pixelate", "PIXELATE_ON", 50, 50, true, "Looks bad with distorition effects"); + GreyScale("GreyScale", "GREYSCALE_ON"); + Posterize("Posterize", "POSTERIZE_ON"); + Blur("Blur", "BLUR_ON"); + GenericEffect("Motion Blur", "MOTIONBLUR_ON", 62, 63); + GenericEffect("Ghost", "GHOST_ON", 64, 65, true, "This effect will not affect the outline", new int[] { 157 }); + GenericEffect("Hologram", "HOLOGRAM_ON", 73, 77, true, null, new int[] { 140, 158 }); + GenericEffect("Chromatic Aberration", "CHROMABERR_ON", 78, 79); + GenericEffect("Glitch", "GLITCH_ON", 80, 80, true, null, new int[] { 139, 180 }); + GenericEffect("Flicker", "FLICKER_ON", 81, 83); + GenericEffect("Shadow", "SHADOW_ON", 84, 87); + GenericEffect("Shine", "SHINE_ON", 133, 138); + GenericEffect("Contrast & Brightness", "CONTRAST_ON", 152, 153); + Overlay("Overlay Texture", "OVERLAY_ON"); + } + + DrawLine(Color.grey, 1, 3); + GUILayout.Label("UV Effects", bigLabelStyle); + + currEnabledDrawers[uvFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[uvFxShapeDrawer], new GUIContent("Show UV Effects"), toggleButtonStyle); + if(currEnabledDrawers[uvFxShapeDrawer]) + { + GenericEffect("Hand Drawn", "DOODLE_ON", 88, 89); + Grass("Grass Movement / Wind", "WIND_ON"); + GenericEffect("Wave", "WAVEUV_ON", 94, 98); + GenericEffect("Round Wave", "ROUNDWAVEUV_ON", 127, 128); + GenericEffect("Rect Size (Enable wireframe to see result)", "RECTSIZE_ON", 99, 99, true, "Only on single sprites spritesheets NOT supported"); + GenericEffect("Offset", "OFFSETUV_ON", 100, 101); + GenericEffect("Clipping / Fill Amount", "CLIPPING_ON", 102, 105); + GenericEffect("Radial Clipping / Radial Fill", "RADIALCLIPPING_ON", 164, 166); + GenericEffect("Texture Scroll", "TEXTURESCROLL_ON", 106, 107, true, "Set Texture Wrap Mode to Repeat"); + GenericEffect("Zoom", "ZOOMUV_ON", 108, 108); + GenericEffect("Distortion", "DISTORT_ON", 109, 112, extraProperties: new int[] { 177 } ); + GenericEffect("Warp Distortion", "WARP_ON", 167, 169); + GenericEffect("Twist", "TWISTUV_ON", 113, 116); + GenericEffect("Rotate", "ROTATEUV_ON", 117, 117, true, "_Tip_ Use Clipping effect to avoid possible undesired parts"); + GenericEffect("Polar Coordinates (Tile texture for good results)", "POLARUV_ON", -1, -1); + GenericEffect("Fish Eye", "FISHEYE_ON", 118, 118); + GenericEffect("Pinch", "PINCH_ON", 119, 119); + GenericEffect("Shake", "SHAKEUV_ON", 120, 122); + } + + SetAndSaveEnabledDrawers(iniDrawers); + } + + private void SetAndSaveEnabledDrawers(uint iniDrawers) + { + uint currDrawers = 0; + for(int i = 0; i < currEnabledDrawers.Length; i++) + { + if(currEnabledDrawers[i]) currDrawers |= materialDrawers[i]; + } + + if(iniDrawers != currDrawers) ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue = currDrawers; + } + + private void Blending() + { + MaterialProperty srcM = ShaderGUI.FindProperty("_MySrcMode", matProperties); + MaterialProperty dstM = ShaderGUI.FindProperty("_MyDstMode", matProperties); + if(srcM.floatValue == 0 && dstM.floatValue == 0) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + } + + GUILayout.Label("This doesn't make much sense in a lit shader", smallLabelStyle); + if(GUILayout.Button("Back To Default Blending")) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + srcMode = (BlendMode)srcM.floatValue; + dstMode = (BlendMode)dstM.floatValue; + srcMode = (BlendMode)EditorGUILayout.EnumPopup("SrcMode", srcMode); + dstMode = (BlendMode)EditorGUILayout.EnumPopup("DstMode", dstMode); + srcM.floatValue = (float)(srcMode); + dstM.floatValue = (float)(dstMode); + + bool ini = oldKeyWords.Contains("PREMULTIPLYALPHA_ON"); + bool toggle = EditorGUILayout.Toggle("Premultiply Alpha?", ini); + if(ini != toggle) Save(); + if(toggle) targetMat.EnableKeyword("PREMULTIPLYALPHA_ON"); + else targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + private void Billboard(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = inspector; + toggle = GUILayout.Toggle(toggle, effectNameLabel); + + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + GUILayout.Label("Don't use this feature on UI elements!", smallLabelStyle); + DrawProperty(129, true); + MaterialProperty billboardY = matProperties[129]; + if(billboardY.floatValue == 1) targetMat.EnableKeyword("BILBOARDY_ON"); + else targetMat.DisableKeyword("BILBOARDY_ON"); + } + else targetMat.DisableKeyword(keyword); + } + + private void ZWrite() + { + MaterialProperty zWrite = ShaderGUI.FindProperty("_ZWrite", matProperties); + bool toggle = zWrite.floatValue > 0.9f ? true : false; + EditorGUILayout.BeginHorizontal(); + { + float tempValue = zWrite.floatValue; + toggle = GUILayout.Toggle(toggle, new GUIContent("Enable Z Write")); + if(toggle) zWrite.floatValue = 1.0f; + else zWrite.floatValue = 0.0f; + if(tempValue != zWrite.floatValue && !Application.isPlaying) Save(); + } + EditorGUILayout.EndHorizontal(); + } + + private void ZTest() + { + MaterialProperty zTestM = ShaderGUI.FindProperty("_ZTestMode", matProperties); + float tempValue = zTestM.floatValue; + zTestMode = (UnityEngine.Rendering.CompareFunction)zTestM.floatValue; + zTestMode = (UnityEngine.Rendering.CompareFunction)EditorGUILayout.EnumPopup("Z TestMode", zTestMode); + zTestM.floatValue = (float)(zTestMode); + if(tempValue != zTestM.floatValue && !Application.isPlaying) Save(); + } + + private void Culling() + { + MaterialProperty cullO = ShaderGUI.FindProperty("_CullingOption", matProperties); + ; + float tempValue = cullO.floatValue; + cullMode = (UnityEngine.Rendering.CullMode)cullO.floatValue; + cullMode = (UnityEngine.Rendering.CullMode)EditorGUILayout.EnumPopup("Culling Mode", cullMode); + cullO.floatValue = (float)(cullMode); + if(tempValue != cullO.floatValue && !Application.isPlaying) Save(); + } + + private void SpriteAtlas(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + toggle = GUILayout.Toggle(toggle, inspector); + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("Make sure SpriteAtlasUV component is added \n " + + "*Check documentation if unsure what this does or how it works", smallLabelStyle); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + } + + private void Outline(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + ".Outline"; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("OUTBASE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(14); + DrawProperty(15); + DrawProperty(16); + DrawEffectSubKeywordToggle("Outline High Resolution?", "OUTBASE8DIR_ON"); + + DrawLine(Color.grey, 1, 3); + bool outlinePixelPerf = DrawEffectSubKeywordToggle("Outline is Pixel Perfect?", "OUTBASEPIXELPERF_ON"); + if(outlinePixelPerf) DrawProperty(18); + else DrawProperty(17); + + DrawLine(Color.grey, 1, 3); + bool outlineTexture = DrawEffectSubKeywordToggle("Outline uses texture?", "OUTTEX_ON"); + if(outlineTexture) + { + DrawProperty(19); + DrawProperty(175); + DrawProperty(20); + DrawProperty(21); + } + + DrawLine(Color.grey, 1, 3); + bool outlineDistort = DrawEffectSubKeywordToggle("Outline uses distortion?", "OUTDIST_ON"); + if(outlineDistort) + { + DrawProperty(22); + DrawProperty(176); + DrawProperty(23); + DrawProperty(24); + DrawProperty(25); + } + + DrawLine(Color.grey, 1, 3); + DrawEffectSubKeywordToggle("Only render outline?", "ONLYOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("OUTBASE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GenericEffect(string inspector, string keyword, int first, int last, bool effectCounter = true, string preMessage = null, int[] extraProperties = null, bool boldToggleLetters = true) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + if(effectCounter) + { + effectNameLabel.text = effectCount + "." + inspector; + effectCount++; + } + else effectNameLabel.text = inspector; + + if(boldToggleLetters) toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + else toggle = GUILayout.Toggle(toggle, effectNameLabel); + + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + if(preMessage != null) GUILayout.Label(preMessage, smallLabelStyle); + for(int i = first; i <= last; i++) DrawProperty(i); + if(extraProperties != null) + foreach(int i in extraProperties) + DrawProperty(i); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + if(boldToggleLetters) EditorGUILayout.EndToggleGroup(); + } + + private void Glow(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GLOW_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useGlowTex = DrawEffectSubKeywordToggle("Use Glow Texture?", "GLOWTEX_ON"); + if(useGlowTex) DrawProperty(6); + + DrawProperty(3); + DrawProperty(4); + DrawProperty(5, true); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GLOW_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorRamp(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("COLORRAMP_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useEditableGradient = false; + if(AssetDatabase.Contains(targetMat)) + { + useEditableGradient = oldKeyWords.Contains("GRADIENTCOLORRAMP_ON"); + bool gradientTex = useEditableGradient; + gradientTex = GUILayout.Toggle(gradientTex, new GUIContent("Use Editable Gradient?")); + if(useEditableGradient != gradientTex) + { + Save(); + if(gradientTex) + { + useEditableGradient = true; + targetMat.EnableKeyword("GRADIENTCOLORRAMP_ON"); + } + else targetMat.DisableKeyword("GRADIENTCOLORRAMP_ON"); + } + + if(useEditableGradient) matEditor.ShaderProperty(matProperties[159], matProperties[159].displayName); + } + else GUILayout.Label("*Save to folder to allow for dynamic Gradient property", smallLabelStyle); + + if(!useEditableGradient) DrawProperty(51); + + DrawProperty(52); + DrawProperty(53, true); + MaterialProperty colorRampOut = matProperties[53]; + if(colorRampOut.floatValue == 1) targetMat.EnableKeyword("COLORRAMPOUTLINE_ON"); + else targetMat.DisableKeyword("COLORRAMPOUTLINE_ON"); + DrawProperty(155); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("COLORRAMP_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorChange(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("CHANGECOLOR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = 123; i < 127; i++) DrawProperty(i); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR2_ON"); + bool toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 2", ini); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR2_ON"); + for(int i = 146; i < 149; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR2_ON"); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR3_ON"); + toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 3", toggle2); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR3_ON"); + for(int i = 149; i < 152; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR3_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("CHANGECOLOR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GreyScale(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GREYSCALE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(54); + DrawProperty(56); + DrawProperty(55, true); + MaterialProperty greyScaleOut = matProperties[55]; + if(greyScaleOut.floatValue == 1) targetMat.EnableKeyword("GREYSCALEOUTLINE_ON"); + else targetMat.DisableKeyword("GREYSCALEOUTLINE_ON"); + DrawProperty(156); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GREYSCALE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Posterize(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("POSTERIZE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(57); + DrawProperty(58); + DrawProperty(59, true); + MaterialProperty posterizeOut = matProperties[59]; + if(posterizeOut.floatValue == 1) targetMat.EnableKeyword("POSTERIZEOUTLINE_ON"); + else targetMat.DisableKeyword("POSTERIZEOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("POSTERIZE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Blur(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("BLUR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("This effect will not affect the outline", smallLabelStyle); + DrawProperty(60); + DrawProperty(61, true); + MaterialProperty blurIsHd = matProperties[61]; + if(blurIsHd.floatValue == 1) targetMat.EnableKeyword("BLURISHD_ON"); + else targetMat.DisableKeyword("BLURISHD_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("BLUR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Grass(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("WIND_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(90); + DrawProperty(91); + DrawProperty(145); + DrawProperty(92); + DrawProperty(93, true); + MaterialProperty grassManual = matProperties[92]; + if(grassManual.floatValue == 1) targetMat.EnableKeyword("MANUALWIND_ON"); + else targetMat.DisableKeyword("MANUALWIND_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("WIND_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void InnerOutline(string inspector, string keyword, int first, int last) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = first; i <= last; i++) DrawProperty(i); + + EditorGUILayout.Separator(); + DrawProperty(72, true); + MaterialProperty onlyInOutline = matProperties[72]; + if(onlyInOutline.floatValue == 1) targetMat.EnableKeyword("ONLYINNEROUTLINE_ON"); + else targetMat.DisableKeyword("ONLYINNEROUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Gradient(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(143, true); + MaterialProperty gradIsRadial = matProperties[143]; + if(gradIsRadial.floatValue == 1) + { + targetMat.EnableKeyword("RADIALGRADIENT_ON"); + DrawProperty(31); + DrawProperty(32); + DrawProperty(34); + DrawProperty(141); + } + else + { + targetMat.DisableKeyword("RADIALGRADIENT_ON"); + bool simpleGradient = oldKeyWords.Contains("GRADIENT2COL_ON"); + bool simpleGradToggle = EditorGUILayout.Toggle("2 Color Gradient?", simpleGradient); + if(simpleGradient && !simpleGradToggle) targetMat.DisableKeyword("GRADIENT2COL_ON"); + else if(!simpleGradient && simpleGradToggle) targetMat.EnableKeyword("GRADIENT2COL_ON"); + DrawProperty(31); + DrawProperty(32); + if(!simpleGradToggle) DrawProperty(33); + DrawProperty(34); + if(!simpleGradToggle) DrawProperty(35); + if(!simpleGradToggle) DrawProperty(141); + DrawProperty(142); + } + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Overlay(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool multModeOn = oldKeyWords.Contains("OVERLAYMULT_ON"); + bool isMultMode = multModeOn; + isMultMode = GUILayout.Toggle(isMultMode, new GUIContent("Is overlay multiplicative?")); + if(multModeOn != isMultMode) + { + Save(); + if(isMultMode) + { + multModeOn = true; + targetMat.EnableKeyword("OVERLAYMULT_ON"); + } + else targetMat.DisableKeyword("OVERLAYMULT_ON"); + } + + if(multModeOn) GUILayout.Label("Overlay is set to multiplicative mode", smallLabelStyle); + else GUILayout.Label("Overlay is set to additive mode", smallLabelStyle); + + + DrawProperty(160); + DrawProperty(178); + DrawProperty(161); + DrawProperty(162); + DrawProperty(163); + + for (int i = 170; i <= 171; i++) + { + DrawProperty(i); + } + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void DrawProperty(int index, bool noReset = false) + { + MaterialProperty targetProperty = matProperties[index]; + + EditorGUILayout.BeginHorizontal(); + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = targetProperty.displayName; + propertyLabel.tooltip = targetProperty.name + " (C#)"; + + matEditor.ShaderProperty(targetProperty, propertyLabel); + + if(!noReset) + { + GUIContent resetButtonLabel = new GUIContent(); + resetButtonLabel.text = "R"; + resetButtonLabel.tooltip = "Resets to default value"; + if(GUILayout.Button(resetButtonLabel, GUILayout.Width(20))) ResetProperty(targetProperty); + } + } + EditorGUILayout.EndHorizontal(); + } + + private void ResetProperty(MaterialProperty targetProperty) + { + AllIn1ShaderPropertyType shaderProperty = EditorUtils.GetShaderTypeByMaterialProperty(targetProperty); + + if(originalMaterialCopy == null) originalMaterialCopy = new Material(targetMat.shader); + if(shaderProperty == AllIn1ShaderPropertyType.Float || shaderProperty == AllIn1ShaderPropertyType.Range) + { + targetProperty.floatValue = originalMaterialCopy.GetFloat(targetProperty.name); + } + else if(shaderProperty == AllIn1ShaderPropertyType.Vector) + { + targetProperty.vectorValue = originalMaterialCopy.GetVector(targetProperty.name); + } + else if(shaderProperty == AllIn1ShaderPropertyType.Color) + { + targetProperty.colorValue = originalMaterialCopy.GetColor(targetProperty.name); + } + else if(shaderProperty == AllIn1ShaderPropertyType.Texture) + { + targetProperty.textureValue = originalMaterialCopy.GetTexture(targetProperty.name); + } + } + + private bool DrawEffectSubKeywordToggle(string inspector, string keyword, bool setCustomConfigAfter = false) + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = inspector; + propertyLabel.tooltip = keyword + " (C#)"; + + bool ini = oldKeyWords.Contains(keyword); + bool toggle = ini; + toggle = GUILayout.Toggle(toggle, propertyLabel); + if(ini != toggle) + { + if(toggle) targetMat.EnableKeyword(keyword); + else targetMat.DisableKeyword(keyword); + } + + return toggle; + } + + private void Save() + { + if(!Application.isPlaying) EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + EditorUtility.SetDirty(targetMat); + } + + private void DrawLine(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + r.height = thickness; + r.y += (padding / 2); + r.x -= 2; + r.width += 6; + EditorGUI.DrawRect(r, color); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs.meta new file mode 100644 index 00000000..55f322a6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 58a451704eab27348bd5177152dc656f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderLitMaterialInspector.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs new file mode 100644 index 00000000..b5ded238 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs @@ -0,0 +1,884 @@ +#if UNITY_EDITOR +using System.Linq; +using AllIn1SpriteShader; +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; +using UnityEngine.Rendering; + +namespace AllIn1SpriteShader +{ + [CanEditMultipleObjects] + public class AllIn1SpriteShaderMaterialInspector : ShaderGUI + { + private Material targetMat; + private BlendMode srcMode, dstMode; + private CompareFunction zTestMode = CompareFunction.LessEqual; + private CullMode cullMode; + + private GUIStyle propertiesStyle, bigLabelStyle, smallLabelStyle, toggleButtonStyle; + private const int bigFontSize = 16, smallFontSize = 11; + private string[] oldKeyWords; + private int effectCount = 1; + private Material originalMaterialCopy; + private MaterialEditor matEditor; + private MaterialProperty[] matProperties; + private uint[] materialDrawers = new uint[] { 1, 2, 4 }; + bool[] currEnabledDrawers; + private const uint advancedConfigDrawer = 0; + private const uint colorFxShapeDrawer = 1; + private const uint uvFxShapeDrawer = 2; + + public bool IsSRPShader() + { + bool res = false; + if(targetMat != null) + { + res = targetMat.shader.name == "AllIn1SpriteShader/AllIn1SpriteShaderSRPBatch"; + } + + return res; + } + + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) + { + matEditor = materialEditor; + matProperties = properties; + targetMat = materialEditor.target as Material; + effectCount = 1; + oldKeyWords = targetMat.shaderKeywords; + propertiesStyle = new GUIStyle(EditorStyles.helpBox); + propertiesStyle.margin = new RectOffset(0, 0, 0, 0); + bigLabelStyle = new GUIStyle(EditorStyles.boldLabel); + bigLabelStyle.fontSize = bigFontSize; + smallLabelStyle = new GUIStyle(EditorStyles.boldLabel); + smallLabelStyle.fontSize = smallFontSize; + toggleButtonStyle = new GUIStyle(GUI.skin.button) { alignment = TextAnchor.MiddleCenter, richText = true }; + currEnabledDrawers = new bool[materialDrawers.Length]; + bool isShaderSRP = IsSRPShader(); + + uint iniDrawers = (uint)ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue; + for(int i = 0; i < materialDrawers.Length; i++) currEnabledDrawers[i] = (materialDrawers[i] & iniDrawers) > 0; + + GUILayout.Label("General Properties", bigLabelStyle); + DrawProperty(0); + if (isShaderSRP) + { + DrawProperty(172); + } + + DrawProperty(1); + DrawProperty(2); + + + currEnabledDrawers[advancedConfigDrawer] = GUILayout.Toggle(currEnabledDrawers[advancedConfigDrawer], new GUIContent("Show Advanced Configuration"), toggleButtonStyle); + if(currEnabledDrawers[advancedConfigDrawer]) + { + + EditorGUILayout.BeginVertical(propertiesStyle); + Blending(); + DrawLine(Color.grey, 1, 3); + Culling(); + DrawLine(Color.grey, 1, 3); + ZTest(); + DrawLine(Color.grey, 1, 3); + ZWrite(); + DrawLine(Color.grey, 1, 3); + GenericEffect("Unity Fog", "FOG_ON", -1, -1, false, boldToggleLetters: false); + DrawLine(Color.grey, 1, 3); + Billboard("Billboard active", "BILBOARD_ON"); + DrawLine(Color.grey, 1, 3); + SpriteAtlas("Sprite inside an atlas?", "ATLAS_ON"); + DrawLine(Color.grey, 1, 3); + materialEditor.EnableInstancingField(); + DrawLine(Color.grey, 1, 3); + materialEditor.RenderQueueField(); + EditorGUILayout.EndVertical(); + } + + EditorGUILayout.Separator(); + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Color Effects", bigLabelStyle); + + currEnabledDrawers[colorFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[colorFxShapeDrawer], new GUIContent("Show Color Effects"), toggleButtonStyle); + if(currEnabledDrawers[colorFxShapeDrawer]) + { + Glow("Glow", "GLOW_ON"); + if (isShaderSRP) + { + GenericEffect("Fade", "FADE_ON", 7, 13, true, null, new int[] { 173, 174 }); + } + else + { + GenericEffect("Fade", "FADE_ON", 7, 13, true); + } + + Outline("Outline", "OUTBASE_ON", isShaderSRP); + GenericEffect("Alpha Outline", "ALPHAOUTLINE_ON", 26, 30, true, "A more performant but less flexible outline"); + InnerOutline("Inner Outline", "INNEROUTLINE_ON", 66, 69); + Gradient("Gradient & Radial Gradient", "GRADIENT_ON"); + GenericEffect("Color Swap", "COLORSWAP_ON", 36, 42, true, "You will need a mask texture (see Documentation)", new int[] { 154 }); + GenericEffect("Hue Shift", "HSV_ON", 43, 45); + ColorChange("Change 1 Color", "CHANGECOLOR_ON"); + ColorRamp("Color Ramp", "COLORRAMP_ON"); + GenericEffect("Hit Effect", "HITEFFECT_ON", 46, 48); + GenericEffect("Negative", "NEGATIVE_ON", 49, 49); + GenericEffect("Pixelate", "PIXELATE_ON", 50, 50, true, "Looks bad with distorition effects"); + GreyScale("GreyScale", "GREYSCALE_ON"); + Posterize("Posterize", "POSTERIZE_ON"); + Blur("Blur", "BLUR_ON"); + GenericEffect("Motion Blur", "MOTIONBLUR_ON", 62, 63); + GenericEffect("Ghost", "GHOST_ON", 64, 65, true, "This effect will not affect the outline", new int[] { 157 }); + GenericEffect("Hologram", "HOLOGRAM_ON", 73, 77, true, null, new int[] { 140, 158 }); + GenericEffect("Chromatic Aberration", "CHROMABERR_ON", 78, 79); + if(!isShaderSRP) GenericEffect("Glitch", "GLITCH_ON", 80, 80, true, null, new int[] { 139, 172 }); + else GenericEffect("Glitch", "GLITCH_ON", 80, 80, true, null, new int[] { 139, 179 }); + GenericEffect("Flicker", "FLICKER_ON", 81, 83); + GenericEffect("Shadow", "SHADOW_ON", 84, 87); + GenericEffect("Shine", "SHINE_ON", 133, 138); + GenericEffect("Contrast & Brightness", "CONTRAST_ON", 152, 153); + Overlay("Overlay Texture", "OVERLAY_ON", isShaderSRP); + GenericEffect("Alpha Cutoff", "ALPHACUTOFF_ON", 70, 70); + GenericEffect("Alpha Round", "ALPHAROUND_ON", 144, 144); + } + + DrawLine(Color.grey, 1, 3); + GUILayout.Label("UV Effects", bigLabelStyle); + + currEnabledDrawers[uvFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[uvFxShapeDrawer], new GUIContent("Show UV Effects"), toggleButtonStyle); + if(currEnabledDrawers[uvFxShapeDrawer]) + { + GenericEffect("Hand Drawn", "DOODLE_ON", 88, 89); + Grass("Grass Movement / Wind", "WIND_ON"); + GenericEffect("Wave", "WAVEUV_ON", 94, 98); + GenericEffect("Round Wave", "ROUNDWAVEUV_ON", 127, 128); + GenericEffect("Rect Size (Enable wireframe to see result)", "RECTSIZE_ON", 99, 99, true, "Only on single sprites spritesheets NOT supported"); + GenericEffect("Offset", "OFFSETUV_ON", 100, 101); + GenericEffect("Clipping / Fill Amount", "CLIPPING_ON", 102, 105); + GenericEffect("Radial Clipping / Radial Fill", "RADIALCLIPPING_ON", 164, 166); + GenericEffect("Texture Scroll", "TEXTURESCROLL_ON", 106, 107, true, "Set Texture Wrap Mode to Repeat"); + GenericEffect("Zoom", "ZOOMUV_ON", 108, 108); + if (isShaderSRP) + { + GenericEffect("Distortion", "DISTORT_ON", 109, 112, true, null, new int[] { 177 }); + } + else + { + GenericEffect("Distortion", "DISTORT_ON", 109, 112); + } + + GenericEffect("Warp Distortion", "WARP_ON", 167, 169); + GenericEffect("Twist", "TWISTUV_ON", 113, 116); + GenericEffect("Rotate", "ROTATEUV_ON", 117, 117, true, "_Tip_ Use Clipping effect to avoid possible undesired parts"); + GenericEffect("Polar Coordinates (Tile texture for good results)", "POLARUV_ON", -1, -1); + GenericEffect("Fish Eye", "FISHEYE_ON", 118, 118); + GenericEffect("Pinch", "PINCH_ON", 119, 119); + GenericEffect("Shake", "SHAKEUV_ON", 120, 122); + } + + SetAndSaveEnabledDrawers(iniDrawers); + } + + private void SetAndSaveEnabledDrawers(uint iniDrawers) + { + uint currDrawers = 0; + for(int i = 0; i < currEnabledDrawers.Length; i++) + { + if(currEnabledDrawers[i]) currDrawers |= materialDrawers[i]; + } + + if(iniDrawers != currDrawers) ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue = currDrawers; + } + + private void Blending() + { + MaterialProperty srcM = ShaderGUI.FindProperty("_MySrcMode", matProperties); + MaterialProperty dstM = ShaderGUI.FindProperty("_MyDstMode", matProperties); + if(srcM.floatValue == 0 && dstM.floatValue == 0) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + } + + GUILayout.Label("Look for 'ShaderLab: Blending' if you don't know what this is", smallLabelStyle); + if(GUILayout.Button("Back To Default Blending")) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + srcMode = (BlendMode)srcM.floatValue; + dstMode = (BlendMode)dstM.floatValue; + srcMode = (BlendMode)EditorGUILayout.EnumPopup("SrcMode", srcMode); + dstMode = (BlendMode)EditorGUILayout.EnumPopup("DstMode", dstMode); + srcM.floatValue = (float)(srcMode); + dstM.floatValue = (float)(dstMode); + + bool ini = oldKeyWords.Contains("PREMULTIPLYALPHA_ON"); + bool toggle = EditorGUILayout.Toggle("Premultiply Alpha?", ini); + if(ini != toggle) Save(); + if(toggle) targetMat.EnableKeyword("PREMULTIPLYALPHA_ON"); + else targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + private void Billboard(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = inspector; + toggle = GUILayout.Toggle(toggle, effectNameLabel); + + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + GUILayout.Label("Don't use this feature on UI elements!", smallLabelStyle); + DrawProperty(129, true); + MaterialProperty billboardY = matProperties[129]; + if(billboardY.floatValue == 1) targetMat.EnableKeyword("BILBOARDY_ON"); + else targetMat.DisableKeyword("BILBOARDY_ON"); + } + else targetMat.DisableKeyword(keyword); + } + + private void ZWrite() + { + MaterialProperty zWrite = ShaderGUI.FindProperty("_ZWrite", matProperties); + bool toggle = zWrite.floatValue > 0.9f ? true : false; + EditorGUILayout.BeginHorizontal(); + { + float tempValue = zWrite.floatValue; + toggle = GUILayout.Toggle(toggle, new GUIContent("Enable Z Write")); + if(toggle) zWrite.floatValue = 1.0f; + else zWrite.floatValue = 0.0f; + if(tempValue != zWrite.floatValue && !Application.isPlaying) Save(); + } + EditorGUILayout.EndHorizontal(); + } + + private void ZTest() + { + MaterialProperty zTestM = ShaderGUI.FindProperty("_ZTestMode", matProperties); + float tempValue = zTestM.floatValue; + zTestMode = (UnityEngine.Rendering.CompareFunction)zTestM.floatValue; + zTestMode = (UnityEngine.Rendering.CompareFunction)EditorGUILayout.EnumPopup("Z TestMode", zTestMode); + zTestM.floatValue = (float)(zTestMode); + if(tempValue != zTestM.floatValue && !Application.isPlaying) Save(); + } + + private void Culling() + { + MaterialProperty cullO = ShaderGUI.FindProperty("_CullingOption", matProperties);; + float tempValue = cullO.floatValue; + cullMode = (UnityEngine.Rendering.CullMode)cullO.floatValue; + cullMode = (UnityEngine.Rendering.CullMode)EditorGUILayout.EnumPopup("Culling Mode", cullMode); + cullO.floatValue = (float)(cullMode); + if(tempValue != cullO.floatValue && !Application.isPlaying) Save(); + } + + private void SpriteAtlas(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + toggle = GUILayout.Toggle(toggle, inspector); + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("Make sure SpriteAtlasUV component is added \n " + + "*Check documentation if unsure what this does or how it works", smallLabelStyle); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + } + + private void Outline(string inspector, string keyword, bool isSRPShader) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + ".Outline"; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("OUTBASE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(14); + DrawProperty(15); + DrawProperty(16); + DrawEffectSubKeywordToggle("Outline High Resolution?", "OUTBASE8DIR_ON"); + + DrawLine(Color.grey, 1, 3); + bool outlinePixelPerf = DrawEffectSubKeywordToggle("Outline is Pixel Perfect?", "OUTBASEPIXELPERF_ON"); + if(outlinePixelPerf) DrawProperty(18); + else DrawProperty(17); + + DrawLine(Color.grey, 1, 3); + bool outlineTexture = DrawEffectSubKeywordToggle("Outline uses texture?", "OUTTEX_ON"); + if(outlineTexture) + { + DrawProperty(19); + DrawProperty(20); + DrawProperty(21); + + if (isSRPShader) + { + DrawProperty(175); + } + } + + DrawLine(Color.grey, 1, 3); + bool outlineDistort = DrawEffectSubKeywordToggle("Outline uses distortion?", "OUTDIST_ON"); + if(outlineDistort) + { + DrawProperty(22); + DrawProperty(23); + DrawProperty(24); + DrawProperty(25); + + if (isSRPShader) + { + DrawProperty(176); + } + } + + DrawLine(Color.grey, 1, 3); + DrawEffectSubKeywordToggle("Only render outline?", "ONLYOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("OUTBASE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GenericEffect(string inspector, string keyword, int first, int last, bool effectCounter = true, string preMessage = null, int[] extraProperties = null, bool boldToggleLetters = true) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + if(effectCounter) + { + effectNameLabel.text = effectCount + "." + inspector; + effectCount++; + } + else effectNameLabel.text = inspector; + if(boldToggleLetters) toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + else toggle = GUILayout.Toggle(toggle, effectNameLabel); + + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + if(preMessage != null) GUILayout.Label(preMessage, smallLabelStyle); + for(int i = first; i <= last; i++) DrawProperty(i); + if(extraProperties != null) + foreach(int i in extraProperties) + DrawProperty(i); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + if(boldToggleLetters) EditorGUILayout.EndToggleGroup(); + } + + private void Glow(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GLOW_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useGlowTex = DrawEffectSubKeywordToggle("Use Glow Texture?", "GLOWTEX_ON"); + if(useGlowTex) DrawProperty(6); + + DrawProperty(3); + DrawProperty(4); + DrawProperty(5, true); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GLOW_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorRamp(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("COLORRAMP_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useEditableGradient = false; + if(AssetDatabase.Contains(targetMat)) + { + useEditableGradient = oldKeyWords.Contains("GRADIENTCOLORRAMP_ON"); + bool gradientTex = useEditableGradient; + gradientTex = GUILayout.Toggle(gradientTex, new GUIContent("Use Editable Gradient?")); + if(useEditableGradient != gradientTex) + { + Save(); + if(gradientTex) + { + useEditableGradient = true; + targetMat.EnableKeyword("GRADIENTCOLORRAMP_ON"); + } + else targetMat.DisableKeyword("GRADIENTCOLORRAMP_ON"); + } + + if(useEditableGradient) matEditor.ShaderProperty(matProperties[159], matProperties[159].displayName); + } + else GUILayout.Label("*Save to folder to allow for dynamic Gradient property", smallLabelStyle); + + if(!useEditableGradient) DrawProperty(51); + + DrawProperty(52); + DrawProperty(53, true); + MaterialProperty colorRampOut = matProperties[53]; + if(colorRampOut.floatValue == 1) targetMat.EnableKeyword("COLORRAMPOUTLINE_ON"); + else targetMat.DisableKeyword("COLORRAMPOUTLINE_ON"); + DrawProperty(155); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("COLORRAMP_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorChange(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("CHANGECOLOR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = 123; i < 127; i++) DrawProperty(i); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR2_ON"); + bool toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 2", ini); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR2_ON"); + for(int i = 146; i < 149; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR2_ON"); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR3_ON"); + toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 3", toggle2); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR3_ON"); + for(int i = 149; i < 152; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR3_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("CHANGECOLOR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GreyScale(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GREYSCALE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(54); + DrawProperty(56); + DrawProperty(55, true); + MaterialProperty greyScaleOut = matProperties[55]; + if(greyScaleOut.floatValue == 1) targetMat.EnableKeyword("GREYSCALEOUTLINE_ON"); + else targetMat.DisableKeyword("GREYSCALEOUTLINE_ON"); + DrawProperty(156); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GREYSCALE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Posterize(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("POSTERIZE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(57); + DrawProperty(58); + DrawProperty(59, true); + MaterialProperty posterizeOut = matProperties[59]; + if(posterizeOut.floatValue == 1) targetMat.EnableKeyword("POSTERIZEOUTLINE_ON"); + else targetMat.DisableKeyword("POSTERIZEOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("POSTERIZE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Blur(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("BLUR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("This effect will not affect the outline", smallLabelStyle); + DrawProperty(60); + DrawProperty(61, true); + MaterialProperty blurIsHd = matProperties[61]; + if(blurIsHd.floatValue == 1) targetMat.EnableKeyword("BLURISHD_ON"); + else targetMat.DisableKeyword("BLURISHD_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("BLUR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Grass(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("WIND_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(90); + DrawProperty(91); + DrawProperty(145); + DrawProperty(92); + DrawProperty(93, true); + MaterialProperty grassManual = matProperties[92]; + if(grassManual.floatValue == 1) targetMat.EnableKeyword("MANUALWIND_ON"); + else targetMat.DisableKeyword("MANUALWIND_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("WIND_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void InnerOutline(string inspector, string keyword, int first, int last) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = first; i <= last; i++) DrawProperty(i); + + EditorGUILayout.Separator(); + DrawProperty(72, true); + MaterialProperty onlyInOutline = matProperties[72]; + if(onlyInOutline.floatValue == 1) targetMat.EnableKeyword("ONLYINNEROUTLINE_ON"); + else targetMat.DisableKeyword("ONLYINNEROUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Gradient(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(143, true); + MaterialProperty gradIsRadial = matProperties[143]; + if(gradIsRadial.floatValue == 1) + { + targetMat.EnableKeyword("RADIALGRADIENT_ON"); + DrawProperty(31); + DrawProperty(32); + DrawProperty(34); + DrawProperty(141); + } + else + { + targetMat.DisableKeyword("RADIALGRADIENT_ON"); + bool simpleGradient = oldKeyWords.Contains("GRADIENT2COL_ON"); + bool simpleGradToggle = EditorGUILayout.Toggle("2 Color Gradient?", simpleGradient); + if(simpleGradient && !simpleGradToggle) targetMat.DisableKeyword("GRADIENT2COL_ON"); + else if(!simpleGradient && simpleGradToggle) targetMat.EnableKeyword("GRADIENT2COL_ON"); + DrawProperty(31); + DrawProperty(32); + if(!simpleGradToggle) DrawProperty(33); + DrawProperty(34); + if(!simpleGradToggle) DrawProperty(35); + if(!simpleGradToggle) DrawProperty(141); + DrawProperty(142); + } + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Overlay(string inspector, string keyword, bool isShaderSRP) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool multModeOn = oldKeyWords.Contains("OVERLAYMULT_ON"); + bool isMultMode = multModeOn; + isMultMode = GUILayout.Toggle(isMultMode, new GUIContent("Is overlay multiplicative?")); + if(multModeOn != isMultMode) + { + Save(); + if(isMultMode) + { + multModeOn = true; + targetMat.EnableKeyword("OVERLAYMULT_ON"); + } + else targetMat.DisableKeyword("OVERLAYMULT_ON"); + } + + if(multModeOn) GUILayout.Label("Overlay is set to multiplicative mode", smallLabelStyle); + else GUILayout.Label("Overlay is set to additive mode", smallLabelStyle); + + for(int i = 160; i <= 163; i++) DrawProperty(i); + for(int i = 170; i <= 171; i++) DrawProperty(i); + + if (isShaderSRP) + { + DrawProperty(178); + } + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void DrawProperty(int index, bool noReset = false) + { + MaterialProperty targetProperty = matProperties[index]; + + EditorGUILayout.BeginHorizontal(); + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = targetProperty.displayName; + propertyLabel.tooltip = targetProperty.name + " (C#)"; + + matEditor.ShaderProperty(targetProperty, propertyLabel); + + if(!noReset) + { + GUIContent resetButtonLabel = new GUIContent(); + resetButtonLabel.text = "R"; + resetButtonLabel.tooltip = "Resets to default value"; + if(GUILayout.Button(resetButtonLabel, GUILayout.Width(20))) ResetProperty(targetProperty); + } + } + EditorGUILayout.EndHorizontal(); + } + + private void ResetProperty(MaterialProperty targetProperty) + { + AllIn1ShaderPropertyType shaderProperty = EditorUtils.GetShaderTypeByMaterialProperty(targetProperty); + + if(originalMaterialCopy == null) originalMaterialCopy = new Material(targetMat.shader); + if(shaderProperty == AllIn1ShaderPropertyType.Float || shaderProperty == AllIn1ShaderPropertyType.Range) + { + targetProperty.floatValue = originalMaterialCopy.GetFloat(targetProperty.name); + } + else if(shaderProperty == AllIn1ShaderPropertyType.Vector) + { + targetProperty.vectorValue = originalMaterialCopy.GetVector(targetProperty.name); + } + else if(shaderProperty == AllIn1ShaderPropertyType.Color) + { + targetProperty.colorValue = originalMaterialCopy.GetColor(targetProperty.name); + } + else if(shaderProperty == AllIn1ShaderPropertyType.Texture) + { + targetProperty.textureValue = originalMaterialCopy.GetTexture(targetProperty.name); + } + } + + private bool DrawEffectSubKeywordToggle(string inspector, string keyword, bool setCustomConfigAfter = false) + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = inspector; + propertyLabel.tooltip = keyword + " (C#)"; + + bool ini = oldKeyWords.Contains(keyword); + bool toggle = ini; + toggle = GUILayout.Toggle(toggle, propertyLabel); + if(ini != toggle) + { + if(toggle) targetMat.EnableKeyword(keyword); + else targetMat.DisableKeyword(keyword); + } + + return toggle; + } + + private void Save() + { + if(!Application.isPlaying) EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + EditorUtility.SetDirty(targetMat); + } + + private void DrawLine(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + r.height = thickness; + r.y += (padding / 2); + r.x -= 2; + r.width += 6; + EditorGUI.DrawRect(r, color); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs.meta new file mode 100644 index 00000000..648374d6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: f42211545c188ae41b1e35cc1ce38187 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderMaterialInspector.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs new file mode 100644 index 00000000..60c642bf --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs @@ -0,0 +1,764 @@ +#if UNITY_EDITOR +using System.Linq; +using AllIn1SpriteShader; +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; +using UnityEngine.Rendering; + +namespace AllIn1SpriteShader +{ + [CanEditMultipleObjects] + public class AllIn1SpriteShaderUiMaskMaterialInspector : ShaderGUI + { + private Material targetMat; + private BlendMode srcMode, dstMode; + + private GUIStyle propertiesStyle, bigLabelStyle, smallLabelStyle, toggleButtonStyle; + private const int bigFontSize = 16, smallFontSize = 11; + private string[] oldKeyWords; + private int effectCount = 1; + private Material originalMaterialCopy; + private MaterialEditor matEditor; + private MaterialProperty[] matProperties; + private uint[] materialDrawers = new uint[] { 1, 2, 4 }; + bool[] currEnabledDrawers; + private const uint advancedConfigDrawer = 0; + private const uint colorFxShapeDrawer = 1; + private const uint uvFxShapeDrawer = 2; + + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) + { + matEditor = materialEditor; + matProperties = properties; + targetMat = materialEditor.target as Material; + effectCount = 1; + oldKeyWords = targetMat.shaderKeywords; + propertiesStyle = new GUIStyle(EditorStyles.helpBox); + propertiesStyle.margin = new RectOffset(0, 0, 0, 0); + bigLabelStyle = new GUIStyle(EditorStyles.boldLabel); + bigLabelStyle.fontSize = bigFontSize; + smallLabelStyle = new GUIStyle(EditorStyles.boldLabel); + smallLabelStyle.fontSize = smallFontSize; + toggleButtonStyle = new GUIStyle(GUI.skin.button) { alignment = TextAnchor.MiddleCenter, richText = true }; + currEnabledDrawers = new bool[materialDrawers.Length]; + uint iniDrawers = (uint)ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue; + for(int i = 0; i < materialDrawers.Length; i++) currEnabledDrawers[i] = (materialDrawers[i] & iniDrawers) > 0; + + GUILayout.Label("General Properties", bigLabelStyle); + DrawProperty(0); + DrawProperty(1); + DrawProperty(2); + + + currEnabledDrawers[advancedConfigDrawer] = GUILayout.Toggle(currEnabledDrawers[advancedConfigDrawer], new GUIContent("Show Advanced Configuration"), toggleButtonStyle); + if(currEnabledDrawers[advancedConfigDrawer]) + { + + EditorGUILayout.BeginVertical(propertiesStyle); + Blending(); + DrawLine(Color.grey, 1, 3); + SpriteAtlas("Sprite inside an atlas?", "ATLAS_ON"); + DrawLine(Color.grey, 1, 3); + materialEditor.EnableInstancingField(); + DrawLine(Color.grey, 1, 3); + materialEditor.RenderQueueField(); + EditorGUILayout.EndVertical(); + } + + EditorGUILayout.Separator(); + DrawLine(Color.grey, 1, 3); + GUILayout.Label("Color Effects", bigLabelStyle); + + currEnabledDrawers[colorFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[colorFxShapeDrawer], new GUIContent("Show Color Effects"), toggleButtonStyle); + if(currEnabledDrawers[colorFxShapeDrawer]) + { + Glow("Glow", "GLOW_ON"); + GenericEffect("Fade", "FADE_ON", 7, 13); + Outline("Outline", "OUTBASE_ON"); + GenericEffect("Alpha Outline", "ALPHAOUTLINE_ON", 26, 30, true, "A more performant but less flexible outline"); + InnerOutline("Inner Outline", "INNEROUTLINE_ON", 66, 69); + Gradient("Gradient & Radial Gradient", "GRADIENT_ON"); + GenericEffect("Color Swap", "COLORSWAP_ON", 36, 42, true, "You will need a mask texture (see Documentation)", new int[] { 154 }); + GenericEffect("Hue Shift", "HSV_ON", 43, 45); + ColorChange("Change 1 Color", "CHANGECOLOR_ON"); + ColorRamp("Color Ramp", "COLORRAMP_ON"); + GenericEffect("Hit Effect", "HITEFFECT_ON", 46, 48); + GenericEffect("Negative", "NEGATIVE_ON", 49, 49); + GenericEffect("Pixelate", "PIXELATE_ON", 50, 50, true, "Looks bad with distorition effects"); + GreyScale("GreyScale", "GREYSCALE_ON"); + Posterize("Posterize", "POSTERIZE_ON"); + Blur("Blur", "BLUR_ON"); + GenericEffect("Motion Blur", "MOTIONBLUR_ON", 62, 63); + GenericEffect("Ghost", "GHOST_ON", 64, 65, true, "This effect will not affect the outline", new int[] { 157 }); + GenericEffect("Hologram", "HOLOGRAM_ON", 73, 77, true, null, new int[] { 140, 158 }); + GenericEffect("Chromatic Aberration", "CHROMABERR_ON", 78, 79); + GenericEffect("Glitch", "GLITCH_ON", 80, 80, true, null, new int[] { 139, 172 }); + GenericEffect("Flicker", "FLICKER_ON", 81, 83); + GenericEffect("Shadow", "SHADOW_ON", 84, 87); + GenericEffect("Shine", "SHINE_ON", 133, 138); + GenericEffect("Contrast & Brightness", "CONTRAST_ON", 152, 153); + Overlay("Overlay Texture", "OVERLAY_ON"); + GenericEffect("Alpha Cutoff", "ALPHACUTOFF_ON", 70, 70); + GenericEffect("Alpha Round", "ALPHAROUND_ON", 144, 144); + } + + DrawLine(Color.grey, 1, 3); + GUILayout.Label("UV Effects", bigLabelStyle); + + currEnabledDrawers[uvFxShapeDrawer] = GUILayout.Toggle(currEnabledDrawers[uvFxShapeDrawer], new GUIContent("Show Alpha Effects"), toggleButtonStyle); + if(currEnabledDrawers[uvFxShapeDrawer]) + { + GenericEffect("Hand Drawn", "DOODLE_ON", 88, 89); + Grass("Grass Movement / Wind", "WIND_ON"); + GenericEffect("Wave", "WAVEUV_ON", 94, 98); + GenericEffect("Round Wave", "ROUNDWAVEUV_ON", 127, 128); + GenericEffect("Rect Size (Enable wireframe to see result)", "RECTSIZE_ON", 99, 99, true, "Only on single sprites spritesheets NOT supported"); + GenericEffect("Offset", "OFFSETUV_ON", 100, 101); + GenericEffect("Clipping / Fill Amount", "CLIPPING_ON", 102, 105); + GenericEffect("Radial Clipping / Radial Fill", "RADIALCLIPPING_ON", 164, 166); + GenericEffect("Texture Scroll", "TEXTURESCROLL_ON", 106, 107, true, "Set Texture Wrap Mode to Repeat"); + GenericEffect("Zoom", "ZOOMUV_ON", 108, 108); + GenericEffect("Distortion", "DISTORT_ON", 109, 112); + GenericEffect("Warp Distortion", "WARP_ON", 167, 169); + GenericEffect("Twist", "TWISTUV_ON", 113, 116); + GenericEffect("Rotate", "ROTATEUV_ON", 117, 117, true, "_Tip_ Use Clipping effect to avoid possible undesired parts"); + GenericEffect("Polar Coordinates (Tile texture for good results)", "POLARUV_ON", -1, -1); + GenericEffect("Fish Eye", "FISHEYE_ON", 118, 118); + GenericEffect("Pinch", "PINCH_ON", 119, 119); + GenericEffect("Shake", "SHAKEUV_ON", 120, 122); + } + + SetAndSaveEnabledDrawers(iniDrawers); + } + + private void SetAndSaveEnabledDrawers(uint iniDrawers) + { + uint currDrawers = 0; + for(int i = 0; i < currEnabledDrawers.Length; i++) + { + if(currEnabledDrawers[i]) currDrawers |= materialDrawers[i]; + } + + if(iniDrawers != currDrawers) ShaderGUI.FindProperty("_EditorDrawers", matProperties).floatValue = currDrawers; + } + + private void Blending() + { + MaterialProperty srcM = ShaderGUI.FindProperty("_MySrcMode", matProperties); + MaterialProperty dstM = ShaderGUI.FindProperty("_MyDstMode", matProperties); + if(srcM.floatValue == 0 && dstM.floatValue == 0) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + } + + GUILayout.Label("Look for 'ShaderLab: Blending' if you don't know what this is", smallLabelStyle); + if(GUILayout.Button("Back To Default Blending")) + { + srcM.floatValue = 5; + dstM.floatValue = 10; + targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + srcMode = (BlendMode)srcM.floatValue; + dstMode = (BlendMode)dstM.floatValue; + srcMode = (BlendMode)EditorGUILayout.EnumPopup("SrcMode", srcMode); + dstMode = (BlendMode)EditorGUILayout.EnumPopup("DstMode", dstMode); + srcM.floatValue = (float)(srcMode); + dstM.floatValue = (float)(dstMode); + + bool ini = oldKeyWords.Contains("PREMULTIPLYALPHA_ON"); + bool toggle = EditorGUILayout.Toggle("Premultiply Alpha?", ini); + if(ini != toggle) Save(); + if(toggle) targetMat.EnableKeyword("PREMULTIPLYALPHA_ON"); + else targetMat.DisableKeyword("PREMULTIPLYALPHA_ON"); + } + + private void SpriteAtlas(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + toggle = GUILayout.Toggle(toggle, inspector); + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("Make sure SpriteAtlasUV component is added \n " + + "*Check documentation if unsure what this does or how it works", smallLabelStyle); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + } + + private void Outline(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + ".Outline"; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("OUTBASE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(14); + DrawProperty(15); + DrawProperty(16); + DrawEffectSubKeywordToggle("Outline High Resolution?", "OUTBASE8DIR_ON"); + + DrawLine(Color.grey, 1, 3); + bool outlinePixelPerf = DrawEffectSubKeywordToggle("Outline is Pixel Perfect?", "OUTBASEPIXELPERF_ON"); + if(outlinePixelPerf) DrawProperty(18); + else DrawProperty(17); + + DrawLine(Color.grey, 1, 3); + bool outlineTexture = DrawEffectSubKeywordToggle("Outline uses texture?", "OUTTEX_ON"); + if(outlineTexture) + { + DrawProperty(19); + DrawProperty(20); + DrawProperty(21); + } + + DrawLine(Color.grey, 1, 3); + bool outlineDistort = DrawEffectSubKeywordToggle("Outline uses distortion?", "OUTDIST_ON"); + if(outlineDistort) + { + DrawProperty(22); + DrawProperty(23); + DrawProperty(24); + DrawProperty(25); + } + + DrawLine(Color.grey, 1, 3); + DrawEffectSubKeywordToggle("Only render outline?", "ONLYOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("OUTBASE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GenericEffect(string inspector, string keyword, int first, int last, bool effectCounter = true, string preMessage = null, int[] extraProperties = null, bool boldToggleLetters = true) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + if(effectCounter) + { + effectNameLabel.text = effectCount + "." + inspector; + effectCount++; + } + else effectNameLabel.text = inspector; + if(boldToggleLetters) toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + else toggle = GUILayout.Toggle(toggle, effectNameLabel); + + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + if(preMessage != null) GUILayout.Label(preMessage, smallLabelStyle); + for(int i = first; i <= last; i++) DrawProperty(i); + if(extraProperties != null) + foreach(int i in extraProperties) + DrawProperty(i); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + if(boldToggleLetters) EditorGUILayout.EndToggleGroup(); + } + + private void Glow(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GLOW_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useGlowTex = DrawEffectSubKeywordToggle("Use Glow Texture?", "GLOWTEX_ON"); + if(useGlowTex) DrawProperty(6); + + DrawProperty(3); + DrawProperty(4); + DrawProperty(5, true); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GLOW_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorRamp(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("COLORRAMP_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool useEditableGradient = false; + if(AssetDatabase.Contains(targetMat)) + { + useEditableGradient = oldKeyWords.Contains("GRADIENTCOLORRAMP_ON"); + bool gradientTex = useEditableGradient; + gradientTex = GUILayout.Toggle(gradientTex, new GUIContent("Use Editable Gradient?")); + if(useEditableGradient != gradientTex) + { + Save(); + if(gradientTex) + { + useEditableGradient = true; + targetMat.EnableKeyword("GRADIENTCOLORRAMP_ON"); + } + else targetMat.DisableKeyword("GRADIENTCOLORRAMP_ON"); + } + + if(useEditableGradient) matEditor.ShaderProperty(matProperties[159], matProperties[159].displayName); + } + else GUILayout.Label("*Save to folder to allow for dynamic Gradient property", smallLabelStyle); + + if(!useEditableGradient) DrawProperty(51); + + DrawProperty(52); + DrawProperty(53, true); + MaterialProperty colorRampOut = matProperties[53]; + if(colorRampOut.floatValue == 1) targetMat.EnableKeyword("COLORRAMPOUTLINE_ON"); + else targetMat.DisableKeyword("COLORRAMPOUTLINE_ON"); + DrawProperty(155); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("COLORRAMP_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void ColorChange(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("CHANGECOLOR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = 123; i < 127; i++) DrawProperty(i); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR2_ON"); + bool toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 2", ini); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR2_ON"); + for(int i = 146; i < 149; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR2_ON"); + + DrawLine(Color.grey, 1, 3); + ini = oldKeyWords.Contains("CHANGECOLOR3_ON"); + toggle2 = ini; + toggle2 = EditorGUILayout.Toggle("Use Color 3", toggle2); + if(ini != toggle2) Save(); + if(toggle2) + { + targetMat.EnableKeyword("CHANGECOLOR3_ON"); + for(int i = 149; i < 152; i++) DrawProperty(i); + } + else targetMat.DisableKeyword("CHANGECOLOR3_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("CHANGECOLOR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void GreyScale(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("GREYSCALE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(54); + DrawProperty(56); + DrawProperty(55, true); + MaterialProperty greyScaleOut = matProperties[55]; + if(greyScaleOut.floatValue == 1) targetMat.EnableKeyword("GREYSCALEOUTLINE_ON"); + else targetMat.DisableKeyword("GREYSCALEOUTLINE_ON"); + DrawProperty(156); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("GREYSCALE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Posterize(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("POSTERIZE_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(57); + DrawProperty(58); + DrawProperty(59, true); + MaterialProperty posterizeOut = matProperties[59]; + if(posterizeOut.floatValue == 1) targetMat.EnableKeyword("POSTERIZEOUTLINE_ON"); + else targetMat.DisableKeyword("POSTERIZEOUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("POSTERIZE_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Blur(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("BLUR_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + GUILayout.Label("This effect will not affect the outline", smallLabelStyle); + DrawProperty(60); + DrawProperty(61, true); + MaterialProperty blurIsHd = matProperties[61]; + if(blurIsHd.floatValue == 1) targetMat.EnableKeyword("BLURISHD_ON"); + else targetMat.DisableKeyword("BLURISHD_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("BLUR_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void Grass(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword("WIND_ON"); + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(90); + DrawProperty(91); + DrawProperty(145); + DrawProperty(92); + DrawProperty(93, true); + MaterialProperty grassManual = matProperties[92]; + if(grassManual.floatValue == 1) targetMat.EnableKeyword("MANUALWIND_ON"); + else targetMat.DisableKeyword("MANUALWIND_ON"); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword("WIND_ON"); + + EditorGUILayout.EndToggleGroup(); + } + + private void InnerOutline(string inspector, string keyword, int first, int last) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + if(first > 0) + { + EditorGUILayout.BeginVertical(propertiesStyle); + { + for(int i = first; i <= last; i++) DrawProperty(i); + + EditorGUILayout.Separator(); + DrawProperty(72, true); + MaterialProperty onlyInOutline = matProperties[72]; + if(onlyInOutline.floatValue == 1) targetMat.EnableKeyword("ONLYINNEROUTLINE_ON"); + else targetMat.DisableKeyword("ONLYINNEROUTLINE_ON"); + } + EditorGUILayout.EndVertical(); + } + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Gradient(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + + EditorGUILayout.BeginVertical(propertiesStyle); + { + DrawProperty(143, true); + MaterialProperty gradIsRadial = matProperties[143]; + if(gradIsRadial.floatValue == 1) + { + targetMat.EnableKeyword("RADIALGRADIENT_ON"); + DrawProperty(31); + DrawProperty(32); + DrawProperty(34); + DrawProperty(141); + } + else + { + targetMat.DisableKeyword("RADIALGRADIENT_ON"); + bool simpleGradient = oldKeyWords.Contains("GRADIENT2COL_ON"); + bool simpleGradToggle = EditorGUILayout.Toggle("2 Color Gradient?", simpleGradient); + if(simpleGradient && !simpleGradToggle) targetMat.DisableKeyword("GRADIENT2COL_ON"); + else if(!simpleGradient && simpleGradToggle) targetMat.EnableKeyword("GRADIENT2COL_ON"); + DrawProperty(31); + DrawProperty(32); + if(!simpleGradToggle) DrawProperty(33); + DrawProperty(34); + if(!simpleGradToggle) DrawProperty(35); + if(!simpleGradToggle) DrawProperty(141); + DrawProperty(142); + } + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void Overlay(string inspector, string keyword) + { + bool toggle = oldKeyWords.Contains(keyword); + bool ini = toggle; + + GUIContent effectNameLabel = new GUIContent(); + effectNameLabel.tooltip = keyword + " (C#)"; + effectNameLabel.text = effectCount + "." + inspector; + toggle = EditorGUILayout.BeginToggleGroup(effectNameLabel, toggle); + + effectCount++; + if(ini != toggle) Save(); + if(toggle) + { + targetMat.EnableKeyword(keyword); + EditorGUILayout.BeginVertical(propertiesStyle); + { + bool multModeOn = oldKeyWords.Contains("OVERLAYMULT_ON"); + bool isMultMode = multModeOn; + isMultMode = GUILayout.Toggle(isMultMode, new GUIContent("Is overlay multiplicative?")); + if(multModeOn != isMultMode) + { + Save(); + if(isMultMode) + { + multModeOn = true; + targetMat.EnableKeyword("OVERLAYMULT_ON"); + } + else targetMat.DisableKeyword("OVERLAYMULT_ON"); + } + + if(multModeOn) GUILayout.Label("Overlay is set to multiplicative mode", smallLabelStyle); + else GUILayout.Label("Overlay is set to additive mode", smallLabelStyle); + + for(int i = 160; i <= 163; i++) DrawProperty(i); + for(int i = 170; i <= 171; i++) DrawProperty(i); + } + EditorGUILayout.EndVertical(); + } + else targetMat.DisableKeyword(keyword); + + EditorGUILayout.EndToggleGroup(); + } + + private void DrawProperty(int index, bool noReset = false) + { + MaterialProperty targetProperty = matProperties[index]; + + EditorGUILayout.BeginHorizontal(); + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = targetProperty.displayName; + propertyLabel.tooltip = targetProperty.name + " (C#)"; + + matEditor.ShaderProperty(targetProperty, propertyLabel); + + if(!noReset) + { + GUIContent resetButtonLabel = new GUIContent(); + resetButtonLabel.text = "R"; + resetButtonLabel.tooltip = "Resets to default value"; + if(GUILayout.Button(resetButtonLabel, GUILayout.Width(20))) ResetProperty(targetProperty); + } + } + EditorGUILayout.EndHorizontal(); + } + + private void ResetProperty(MaterialProperty targetProperty) + { + AllIn1ShaderPropertyType propertyType = EditorUtils.GetShaderTypeByMaterialProperty(targetProperty); + + if(originalMaterialCopy == null) originalMaterialCopy = new Material(targetMat.shader); + if(propertyType == AllIn1ShaderPropertyType.Float || propertyType == AllIn1ShaderPropertyType.Range) + { + targetProperty.floatValue = originalMaterialCopy.GetFloat(targetProperty.name); + } + else if(propertyType == AllIn1ShaderPropertyType.Vector) + { + targetProperty.vectorValue = originalMaterialCopy.GetVector(targetProperty.name); + } + else if(propertyType == AllIn1ShaderPropertyType.Color) + { + targetProperty.colorValue = originalMaterialCopy.GetColor(targetProperty.name); + } + else if(propertyType == AllIn1ShaderPropertyType.Texture) + { + targetProperty.textureValue = originalMaterialCopy.GetTexture(targetProperty.name); + } + } + + private bool DrawEffectSubKeywordToggle(string inspector, string keyword, bool setCustomConfigAfter = false) + { + GUIContent propertyLabel = new GUIContent(); + propertyLabel.text = inspector; + propertyLabel.tooltip = keyword + " (C#)"; + + bool ini = oldKeyWords.Contains(keyword); + bool toggle = ini; + toggle = GUILayout.Toggle(toggle, propertyLabel); + if(ini != toggle) + { + if(toggle) targetMat.EnableKeyword(keyword); + else targetMat.DisableKeyword(keyword); + } + + return toggle; + } + + private void Save() + { + if(!Application.isPlaying) EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + EditorUtility.SetDirty(targetMat); + } + + private void DrawLine(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + r.height = thickness; + r.y += (padding / 2); + r.x -= 2; + r.width += 6; + EditorGUI.DrawRect(r, color); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs.meta new file mode 100644 index 00000000..64426140 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: bcdb12210426bb34cb44a19ffb54132d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/AllIn1SpriteShaderUiMaskMaterialInspector.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/Constants.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/Constants.cs new file mode 100644 index 00000000..a711f5d6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/Constants.cs @@ -0,0 +1,7 @@ +namespace AllIn1SpriteShader +{ + public static class Constants + { + public const string MAIN_ASSEMBLY_NAME = "AllIn1SpriteShaderAssembly.asmdef"; + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/Constants.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/Constants.cs.meta new file mode 100644 index 00000000..b6d46cc9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/Constants.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: dd7850185e6f57c4596c42efd4dccc33 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/Constants.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/EditorUtils.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/EditorUtils.cs new file mode 100644 index 00000000..e67fd8af --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/EditorUtils.cs @@ -0,0 +1,77 @@ +#if UNITY_EDITOR +using UnityEditor; + +namespace AllIn1SpriteShader +{ + public static class EditorUtils + { + public static string UnifyEOL(string text) + { + if(string.IsNullOrEmpty(text)) return text; + + text = text.Replace("\r\n", "\n"); + text = text.Replace("\r", "\n"); + return text; + } + + public static AllIn1ShaderPropertyType GetShaderTypeByMaterialProperty(MaterialProperty matProperty) + { + AllIn1ShaderPropertyType res; + +#if UNITY_6000_2_OR_NEWER + switch (matProperty.propertyType) + { + case UnityEngine.Rendering.ShaderPropertyType.Color: + res = AllIn1ShaderPropertyType.Color; + break; + case UnityEngine.Rendering.ShaderPropertyType.Float: + res = AllIn1ShaderPropertyType.Float; + break; + case UnityEngine.Rendering.ShaderPropertyType.Int: + res = AllIn1ShaderPropertyType.Int; + break; + case UnityEngine.Rendering.ShaderPropertyType.Range: + res = AllIn1ShaderPropertyType.Range; + break; + case UnityEngine.Rendering.ShaderPropertyType.Texture: + res = AllIn1ShaderPropertyType.Texture; + break; + case UnityEngine.Rendering.ShaderPropertyType.Vector: + res = AllIn1ShaderPropertyType.Vector; + break; + default: + res = AllIn1ShaderPropertyType.Vector; + break; + } +#else + switch (matProperty.type) + { + case MaterialProperty.PropType.Color: + res = AllIn1ShaderPropertyType.Color; + break; + case MaterialProperty.PropType.Float: + res = AllIn1ShaderPropertyType.Float; + break; + case MaterialProperty.PropType.Int: + res = AllIn1ShaderPropertyType.Int; + break; + case MaterialProperty.PropType.Range: + res = AllIn1ShaderPropertyType.Range; + break; + case MaterialProperty.PropType.Texture: + res = AllIn1ShaderPropertyType.Texture; + break; + case MaterialProperty.PropType.Vector: + res = AllIn1ShaderPropertyType.Vector; + break; + default: + res = AllIn1ShaderPropertyType.Vector; + break; + } +#endif + return res; + + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/EditorUtils.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/EditorUtils.cs.meta new file mode 100644 index 00000000..ac9dff38 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/EditorUtils.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 44cca39610f3ac740aaa53036cfef5d4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/EditorUtils.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs new file mode 100644 index 00000000..b5e12311 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs @@ -0,0 +1,75 @@ +////////////////////////////////////////////////////// +// Shader Packager +// Copyright (c) Jason Booth +////////////////////////////////////////////////////// +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +#if UNITY_2019_3_OR_NEWER + +// Installs custom defines for render pipelines (e.g., USING_HDRP) to enable conditional compilation +// across different pipelines. Unity doesn't provide these defines out of the box, so this helper +// simplifies cross-pipeline compatibility. + +namespace AllIn1SpriteShader +{ + public static class RenderPipelineChecker + { + private const string HDRP_PACKAGE = "HDRenderPipelineAsset"; + private const string URP_PACKAGE = "UniversalRenderPipelineAsset"; + + public static bool IsHDRP + { + get; private set; + } + public static bool IsURP + { + get; private set; + } + public static bool IsStandardRP + { + get; private set; + } + + public static void RefreshData() + { + IsHDRP = DoesTypeExist(HDRP_PACKAGE); + IsURP = DoesTypeExist(URP_PACKAGE); + + if (!(IsHDRP || IsURP)) + { + IsStandardRP = true; + } + + } + + public static bool DoesTypeExist(string className) + { + var foundType = (from assembly in AppDomain.CurrentDomain.GetAssemblies() + from type in GetTypesSafe(assembly) + where type.Name == className + select type).FirstOrDefault(); + + return foundType != null; + } + + public static IEnumerable GetTypesSafe(System.Reflection.Assembly assembly) + { + Type[] types; + + try + { + types = assembly.GetTypes(); + } + catch (ReflectionTypeLoadException e) + { + types = e.Types; + } + + return types.Where(x => x != null); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs.meta new file mode 100644 index 00000000..57f1367e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 83ac30b66f3fe444189a98a9bb648c51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Editor/RenderPipelineChecker.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs new file mode 100644 index 00000000..e933c8be --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs @@ -0,0 +1,37 @@ +using UnityEngine; +using UnityEngine.UI; + +namespace AllIn1SpriteShader +{ + public class RandomSeed : MonoBehaviour + { + private readonly int randomSeedProperty = Shader.PropertyToID("_RandomSeed"); + private MaterialPropertyBlock propertyBlock; + + //If you want to randomize UI Images, you'll need to create different materials since materials are always shared + //This can be done at runtime with scripting or manually in the editor + private void Start() + { + Renderer renderer = GetComponent(); + if(renderer != null) + { + propertyBlock = new MaterialPropertyBlock(); + propertyBlock.SetFloat(randomSeedProperty, Random.Range(0f, 100f)); + renderer.SetPropertyBlock(propertyBlock); + } + else + { + Image image = GetComponent(); + if (image != null) + { + if (image.material != null) + { + image.material.SetFloat(randomSeedProperty, Random.Range(0, 1000f)); + } + else Debug.LogError("Missing Material on UI Image: " + gameObject.name); + } + else Debug.LogError("Missing Renderer or UI Image on: " + gameObject.name); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs.meta new file mode 100644 index 00000000..4016bfa6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 6078fd4d3c5bd6f4087f8869458662dd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/RandomSeed.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs new file mode 100644 index 00000000..4d91e55f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs @@ -0,0 +1,179 @@ +using UnityEngine; +using UnityEngine.UI; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace AllIn1SpriteShader +{ + [ExecuteInEditMode] + public class SetAtlasUvs : MonoBehaviour + { + [SerializeField] private bool updateEveryFrame = false; + [Tooltip("If using a Sprite Renderer it will use the material property instead of sharedMaterial"), SerializeField] private bool useMaterialInstanceIfPossible = false; + private Renderer render; + private SpriteRenderer spriteRender; + private Image uiImage; + private bool isUI = false; + private readonly int minXuv = Shader.PropertyToID("_MinXUV"); + private readonly int maxXuv = Shader.PropertyToID("_MaxXUV"); + private readonly int minYuv = Shader.PropertyToID("_MinYUV"); + private readonly int maxYuv = Shader.PropertyToID("_MaxYUV"); + + private void Start() + { + Setup(); + } + + private void Reset() + { + Setup(); + } + + private void Setup() + { + if (GetRendererReferencesIfNeeded()) GetAndSetUVs(); + if (!updateEveryFrame && Application.isPlaying && this != null) this.enabled = false; + } + + private void LateUpdate() + { + if (updateEveryFrame) + { + GetAndSetUVs(); + } + } + + public bool GetAndSetUVs() + { + if (!GetRendererReferencesIfNeeded()) return false; + + if (!isUI) + { + Sprite sprite = spriteRender.sprite; + Rect r = sprite.textureRect; + r.x /= sprite.texture.width; + r.width /= sprite.texture.width; + r.y /= sprite.texture.height; + r.height /= sprite.texture.height; + + if(useMaterialInstanceIfPossible && Application.isPlaying) + { + render.material.SetFloat(minXuv, r.xMin); + render.material.SetFloat(maxXuv, r.xMax); + render.material.SetFloat(minYuv, r.yMin); + render.material.SetFloat(maxYuv, r.yMax); + } + else + { + render.sharedMaterial.SetFloat(minXuv, r.xMin); + render.sharedMaterial.SetFloat(maxXuv, r.xMax); + render.sharedMaterial.SetFloat(minYuv, r.yMin); + render.sharedMaterial.SetFloat(maxYuv, r.yMax); + } + } + else + { + Rect r = uiImage.sprite.textureRect; + r.x /= uiImage.sprite.texture.width; + r.width /= uiImage.sprite.texture.width; + r.y /= uiImage.sprite.texture.height; + r.height /= uiImage.sprite.texture.height; + + uiImage.material.SetFloat(minXuv, r.xMin); + uiImage.material.SetFloat(maxXuv, r.xMax); + uiImage.material.SetFloat(minYuv, r.yMin); + uiImage.material.SetFloat(maxYuv, r.yMax); + } + + return true; + } + + public void ResetAtlasUvs() + { + if (!GetRendererReferencesIfNeeded()) return; + + if (!isUI) + { + if(useMaterialInstanceIfPossible && Application.isPlaying) + { + render.material.SetFloat(minXuv, 0f); + render.material.SetFloat(maxXuv, 1f); + render.material.SetFloat(minYuv, 0f); + render.material.SetFloat(maxYuv, 1f); + } + else + { + render.sharedMaterial.SetFloat(minXuv, 0f); + render.sharedMaterial.SetFloat(maxXuv, 1f); + render.sharedMaterial.SetFloat(minYuv, 0f); + render.sharedMaterial.SetFloat(maxYuv, 1f); + } + } + else + { + uiImage.material.SetFloat(minXuv, 0f); + uiImage.material.SetFloat(maxXuv, 1f); + uiImage.material.SetFloat(minYuv, 0f); + uiImage.material.SetFloat(maxYuv, 1f); + } + } + + public void UpdateEveryFrame(bool everyFrame) + { + updateEveryFrame = everyFrame; + } + + private bool GetRendererReferencesIfNeeded() + { + if (spriteRender == null) spriteRender = GetComponent(); + if (spriteRender != null) + { + if (spriteRender.sprite == null) + { + #if UNITY_EDITOR + EditorUtility.DisplayDialog("No sprite found", "The object: " + gameObject.name + ", has Sprite Renderer but no sprite", "Ok"); + #endif + DestroyImmediate(this); + return false; + } + if (render == null) render = GetComponent(); + isUI = false; + } + else + { + if (uiImage == null) + { + uiImage = GetComponent(); + if (uiImage != null) + { + #if UNITY_EDITOR + Debug.Log("You added the SetAtlasUv component to: " + gameObject.name + " that has a UI Image\n " + + "This SetAtlasUV component will only work properly on UI Images if each Image has a DIFFERENT material instance (See Documentation Sprite Atlases section for more info)"); + #endif + } + else + { + #if UNITY_EDITOR + EditorUtility.DisplayDialog("No Renderer or UI Graphic found", "This SetAtlasUV component will now get destroyed", "Ok"); + #endif + DestroyImmediate(this); + return false; + } + } + if (render == null) render = GetComponent(); + isUI = true; + } + + if (spriteRender == null && uiImage == null) + { + #if UNITY_EDITOR + EditorUtility.DisplayDialog("No Renderer or UI Graphic found", "This SetAtlasUV component will now get destroyed", "Ok"); + #endif + DestroyImmediate(this); + return false; + } + return true; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs.meta new file mode 100644 index 00000000..cd0b62bc --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 1625263d85e5d554284989eb9052e863 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/SetAtlasUvs.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTime.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTime.cs new file mode 100644 index 00000000..ea0afbf6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTime.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace AllIn1SpriteShader +{ + //This script is made with Unity version 2019 and onward in mind + //This script will pass in the Unscaled Time to the shader to animate the effects even when the game is paused + //Set shaders to Scaled Time variant and add this script to an active GameObject to see the results + //Video tutorial about it: https://youtu.be/7_BggIufV-w + [ExecuteInEditMode] + public class SetGlobalTime : MonoBehaviour + { + int globalTime; + + private void Start() + { + globalTime = Shader.PropertyToID("globalUnscaledTime"); + } + + private void Update() + { + Shader.SetGlobalFloat(globalTime, Time.unscaledTime / 20f); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTime.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTime.cs.meta new file mode 100644 index 00000000..ed2698c3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTime.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: c6c0770c7b77d3f45ab8c8d42b794c51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/SetGlobalTime.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/SpritePropertiesSync.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/SpritePropertiesSync.cs new file mode 100644 index 00000000..58c46c74 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/SpritePropertiesSync.cs @@ -0,0 +1,92 @@ +using UnityEngine; +using UnityEngine.Rendering; + +namespace AllIn1SpriteShader +{ + [ExecuteInEditMode] + [RequireComponent(typeof(SpriteRenderer))] + public class SpritePropertiesSync : MonoBehaviour + { + public enum CastShadowMode + { + [InspectorName("Off")] OFF, + [InspectorName("One Sided")] ONE_SIDED, + [InspectorName("Two Sided")] TWO_SIDED + } + + private static int PROPID_SPRITE_FLIP = Shader.PropertyToID("_SpriteFlip"); + + public SpriteRenderer spr; + public bool isMaterialDrivenByAnimator; + + [SerializeField] private CastShadowMode shadowCastingMode = CastShadowMode.TWO_SIDED; + + private MaterialPropertyBlock matPropBlock; + + public void Start() + { + if(spr == null) spr = GetComponent(); + if(spr == null) + { + Debug.LogWarning($"Sprite Renderer is null in SpritePropertiesSync-{gameObject.name}", gameObject); + enabled = false; + return; + } + matPropBlock = new MaterialPropertyBlock(); + UpdateRendererShadowCastingMode(); + } + + private void LateUpdate() + { + if(spr == null || spr.sharedMaterial == null) + { + Debug.LogError($"Incorrect setup in SpritePropertiesSync-{gameObject.name}", gameObject); + enabled = false; + return; + } + +#if UNITY_EDITOR + if (matPropBlock == null) matPropBlock = new MaterialPropertyBlock(); + UpdateRendererShadowCastingMode(); +#endif + + UpdateMaterial(); + } + + private void UpdateRendererShadowCastingMode() + { + switch (shadowCastingMode) + { + case CastShadowMode.OFF: + spr.shadowCastingMode = ShadowCastingMode.Off; + break; + case CastShadowMode.ONE_SIDED: + spr.shadowCastingMode = ShadowCastingMode.On; + break; + case CastShadowMode.TWO_SIDED: + spr.shadowCastingMode = ShadowCastingMode.TwoSided; + break; + } + } + + private void UpdateMaterial() + { + spr.GetPropertyBlock(matPropBlock); + + float flipX = spr.flipX ? -1f : 1f; + float flipY = spr.flipY ? -1f : 1f; + Vector3 localScale = spr.transform.localScale; + float scaleSign = Mathf.Sign(localScale.x * localScale.y * localScale.z * flipX * flipY); + Vector4 vecFlip = new Vector4(flipX, flipY, flipX, flipY); + if (Application.isPlaying && isMaterialDrivenByAnimator) + { + vecFlip.x = 1.0f; + vecFlip.y = 1.0f; + } + vecFlip.z = scaleSign; + + matPropBlock.SetVector(PROPID_SPRITE_FLIP, vecFlip); + spr.SetPropertyBlock(matPropBlock); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/SpritePropertiesSync.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/SpritePropertiesSync.cs.meta new file mode 100644 index 00000000..3ae6fb55 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/SpritePropertiesSync.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 38fbd5bf8eb2ab740896fa4bd7b94843 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/SpritePropertiesSync.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture.meta new file mode 100644 index 00000000..e1631cb1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 30ea7cd4d865fef46b7a1ea7e98943a1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png b/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png new file mode 100644 index 00000000..94f5ee43 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png.meta new file mode 100644 index 00000000..a61daa1f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png.meta @@ -0,0 +1,99 @@ +fileFormatVersion: 2 +guid: 917b41800d6604d4e99bef50da598d65 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + 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: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 692da10dc1b5aa741a39ec794b64c334 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/Texture/AllIn1SpriteShaderEditorImage.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs b/Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs new file mode 100644 index 00000000..c4c051d8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs @@ -0,0 +1,39 @@ +#if LETAI_TRUESHADOW +using LeTai.TrueShadow; +using LeTai.TrueShadow.PluginInterfaces; +using UnityEngine; + +namespace AllIn1SpriteShader +{ + [ExecuteAlways] + public class TrueShadowCompatibility : MonoBehaviour, ITrueShadowCustomHashProvider + { + [Tooltip("Use with animated effects")] + public bool updateTrueShadowEveryFrame = false; + private TrueShadow shadow; + + public void UpdateTrueShadow() + { + if (!shadow) shadow = GetComponent(); + if (!shadow) return; + + UpdateTrueShadow(shadow); + } + + public static void UpdateTrueShadow(TrueShadow shadow) + { + shadow.CustomHash = Random.Range(int.MinValue, int.MaxValue); + } + + public void Update() + { + bool shouldDirty = updateTrueShadowEveryFrame; +#if UNITY_EDITOR + shouldDirty |= !Application.isPlaying; +#endif + if (shouldDirty) + UpdateTrueShadow(); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs.meta b/Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs.meta new file mode 100644 index 00000000..2fcb5523 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 279c59909b723da49b1f2cf62d25b06a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Scripts/TrueShadowCompatibility.cs + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders.meta new file mode 100644 index 00000000..5d56747a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 42ce74ee1ab07574bbe2c76ca27d7c20 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc new file mode 100644 index 00000000..0821f15c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc @@ -0,0 +1,71 @@ +//Prevent Unity warnings that are not relevant for this shader------------------- +#pragma warning (disable : 3571) // pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them +#pragma warning (disable : 4008) // floating point division by zero +#pragma warning (disable : 3206) // implicit truncation of vector type +//BLURS------------------------------------------------------------------------- +half4 Blur(half2 uv, sampler2D source, half Intensity) +{ + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = tex2D(source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = tex2D(source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; +} + +half BlurHD_G(half bhqp, half x) +{ + return exp(-(x * x) / (2.0 * bhqp * bhqp)); +} +half4 BlurHD(half2 uv, sampler2D source, half BlurAmount, half xScale, half yScale) +{ + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += tex2D(source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; +} +//----------------------------------------------------------------------- +half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; +} + +half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; +} + +half rand2CustomTime(half2 seed, half offset, half customTime, half speed) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; +} +//----------------------------------------------------------------------- +half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc.meta new file mode 100644 index 00000000..d461ba95 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: df06cdcb3555be745b54ff3003fa687e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1OneShaderFunctions.cginc + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader new file mode 100644 index 00000000..a23b3424 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader @@ -0,0 +1,1234 @@ +Shader "AllIn1SpriteShader/AllIn1SpriteShader" +{ + Properties + { + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 0.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //172 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + } + + SubShader + { + Tags { "Queue" = "Transparent" "CanUseSpriteAtlas" = "True" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" } + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + Pass + { + CGPROGRAM + #pragma multi_compile_instancing + #pragma vertex vert + #pragma fragment frag + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHAROUND_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature ATLAS_ON + #pragma shader_feature PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + #pragma shader_feature FOG_ON + + #include "UnityCG.cginc" + #include "AllIn1OneShaderFunctions.cginc" + + #if FOG_ON + #pragma multi_compile_fog + #endif + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + half4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + half4 color : COLOR; + #if OUTTEX_ON + half2 uvOutTex : TEXCOORD1; + #endif + #if OUTDIST_ON + half2 uvOutDistTex : TEXCOORD2; + #endif + #if DISTORT_ON + half2 uvDistTex : TEXCOORD3; + #endif + #if FOG_ON + UNITY_FOG_COORDS(4) + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + sampler2D _MainTex; + half4 _MainTex_ST, _MainTex_TexelSize, _Color; + half _Alpha; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if FADE_ON + sampler2D _FadeTex, _FadeBurnTex; + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if GLOW_ON + sampler2D _GlowTex; + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + sampler2D _OutlineTex; + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + sampler2D _OutlineDistortTex; + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if DISTORT_ON + sampler2D _DistortTex; + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + sampler2D _ColorSwapTex; + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if COLORRAMP_ON + sampler2D _ColorRampTex, _ColorRampTexGradient; + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + sampler2D _ShineMask; + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if ALPHACUTOFF_ON + half _AlphaCutoffValue; + #endif + + #if ALPHAROUND_ON + half _AlphaRoundThreshold; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + sampler2D _OverlayTex; + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + UNITY_INSTANCING_BUFFER_START(Props) + UNITY_DEFINE_INSTANCED_PROP(float, _RandomSeed) + UNITY_INSTANCING_BUFFER_END(Props) + + v2f vert (appdata v) + { + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + o.vertex = UnityObjectToClipPos(half4(localPos, 1)); + #else + o.vertex = UnityObjectToClipPos(v.vertex); + #endif + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + #if POLARUV_ON + o.uv = v.uv - center; + #endif + + #if ROTATEUV_ON + half2 uvC = v.uv; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + o.uv = mul(rot, uvC); + o.uv += center; + #endif + + #if OUTTEX_ON + o.uvOutTex = TRANSFORM_TEX(v.uv, _OutlineTex); + #endif + + #if OUTDIST_ON + o.uvOutDistTex = TRANSFORM_TEX(v.uv, _OutlineDistortTex); + #endif + + #if DISTORT_ON + o.uvDistTex = TRANSFORM_TEX(v.uv, _DistortTex); + #endif + + #if FOG_ON + UNITY_TRANSFER_FOG(o,o.vertex); + #endif + + return o; + } + + half3 GetPixel(in int offsetX, in int offsetY, half2 uv, sampler2D tex) + { + return tex2D(tex, (uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y))).rgb; + } + + half4 frag (v2f i) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + half randomSeed = UNITY_ACCESS_INSTANCED_PROP(Props, _RandomSeed); + + float2 uvRect = i.uv; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((i.uv.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + #if CLIPPING_ON + half2 tiledUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + #if TEXTURESCROLL_ON && ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + + #if OFFSETUV_ON + #if ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + i.uv += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + #if POLARUV_ON + i.uv = half2(atan2(i.uv.y, i.uv.x) / (2.0f * 3.141592653589f), length(i.uv)); + i.uv *= _MainTex_ST.xy; + #endif + + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = i.uv - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + i.uv = tempUv; + #endif + + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = i.uv - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + i.uv = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + + #if PINCH_ON + half2 dP = i.uv - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + i.uv = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + #if ZOOMUV_ON + i.uv -= centerTiled; + i.uv = i.uv * _ZoomUvAmount; + i.uv += centerTiled; + #endif + + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + i.uv = lerp(i.uv, i.uv + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + i.uv += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if RECTSIZE_ON + i.uv = i.uv.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + #if DISTORT_ON + #if ATLAS_ON + i.uvDistTex.x = i.uvDistTex.x * (1 / (_MaxXUV - _MinXUV)); + i.uvDistTex.y = i.uvDistTex.y * (1 / (_MaxYUV - _MinYUV)); + #endif + i.uvDistTex.x += ((_Time.x + randomSeed) * _DistortTexXSpeed) % 1; + i.uvDistTex.y += ((_Time.x + randomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (tex2D(_DistortTex, i.uvDistTex).r - 0.5) * 0.2 * _DistortAmount; + i.uv.x += distortAmnt; + i.uv.y += distortAmnt; + #endif + + #if WARP_ON + half2 warpUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + i.uv += warp; + #endif + + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - i.uv; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + i.uv = i.uv + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + i.uv += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = i.uv - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + i.uv = i.uv + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + #if TEXTURESCROLL_ON && !ATLAS_ON + i.uv.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + i.uv.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + i.uv = floor(i.uv * pixelSize) / pixelSize; + #endif + + half4 col = tex2D(_MainTex, i.uv); + half originalAlpha = col.a; + col *= i.color; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = tex2D(_MainTex, i.uv + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * i.color; + #endif + + #if CHROMABERR_ON + half4 r = tex2D(_MainTex, i.uv + half2(_ChromAberrAmount/10, 0)) * i.color; + half4 b = tex2D(_MainTex, i.uv + half2(-_ChromAberrAmount/10, 0)) * i.color; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * i.color; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, 1, 1) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity) * i.color; + #endif + #endif + #endif + + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + half luminance = 0; + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, i.uv, _MainTex) - GetPixel(0, -_InnerOutlineThickness, i.uv, _MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, i.uv, _MainTex) - GetPixel(-_InnerOutlineThickness, 0, i.uv, _MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = tex2D(_ColorSwapTex, i.uv); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if OVERLAY_ON + half2 overlayUvs = uvRect; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = tex2D(_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //OUTLINE------------------------------------------------------------- + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + half2 uvOutDist = uvRect; + uvOutDist.x += ((_Time.x + randomSeed) * _OutlineDistortTexXSpeed) % 1; + uvOutDist.y += ((_Time.x + randomSeed) * _OutlineDistortTexYSpeed) % 1; + half outDistortAmnt = (tex2D(_OutlineDistortTex, TRANSFORM_TEX(uvOutDist, _OutlineDistortTex)).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = tex2D(_MainTex, i.uv + half2(destUv.x, 0)).a; + half spriteRight = tex2D(_MainTex, i.uv - half2(destUv.x, 0)).a; + half spriteBottom = tex2D(_MainTex, i.uv + half2(0, destUv.y)).a; + half spriteTop = tex2D(_MainTex, i.uv - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = tex2D(_MainTex, i.uv + half2(destUv.x, destUv.y)).a; + half spriteTopRight = tex2D(_MainTex, i.uv + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = tex2D(_MainTex, i.uv + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = tex2D(_MainTex, i.uv + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + i.uvOutTex.x += ((_Time.x + randomSeed) * _OutlineTexXSpeed) % 1; + i.uvOutTex.y += ((_Time.x + randomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutTex = half2((i.uvOutTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = tex2D(_OutlineTex, i.uvOutTex); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * i.color.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //----------------------------------------------------------------------------- + + #if FADE_ON + half2 tiledUvFade1= TRANSFORM_TEX(i.uv, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(i.uv, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = tex2D(_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * tex2D(_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + + #if SHADOW_ON + half shadowA = tex2D(_MainTex, i.uv + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * i.color.a, col.a); + #endif + + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = tex2D(_GlowTex, i.uv); + #else + emission = col; + #endif + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = tex2D(_ShineMask, i.uv).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + + col.a *= _Alpha; + + #if ALPHACUTOFF_ON + clip((1 - _AlphaCutoffValue) - (1 - col.a) - 0.01); + #endif + + #if ALPHAROUND_ON + col.a = step(_AlphaRoundThreshold, col.a); + #endif + + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + + col *= _Color; + + #if FOG_ON + UNITY_APPLY_FOG(i.fogCoord, col); + #endif + + return col; + } + ENDCG + } + } + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderMaterialInspector" + //Fallback "Sprites/Default" //Remove fallback so that any shader error is obvious to the user +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader.meta new file mode 100644 index 00000000..02893146 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader.meta @@ -0,0 +1,28 @@ +fileFormatVersion: 2 +guid: a36b7719ff0465b42ab1407d67672c5f +ShaderImporter: + externalObjects: {} + defaultTextures: + - _MainTex: {instanceID: 0} + - _GlowTex: {instanceID: 0} + - _FadeTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _FadeBurnTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + - _OutlineTex: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + - _OutlineDistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _ColorSwapTex: {instanceID: 0} + - _ColorRampTex: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + - _DistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _ShineMask: {instanceID: 0} + - _ColorRampTexGradient: {instanceID: 0} + - _OverlayTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShader.shader + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader new file mode 100644 index 00000000..277b67e8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader @@ -0,0 +1,5258 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: URP2023 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Opaque" "UniversalMaterialType" = "Lit" "Queue" = "Geometry" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW + #pragma multi_compile_fragment _ _SHADOWS_SOFT_MEDIUM + #pragma multi_compile_fragment _ _SHADOWS_SOFT_HIGH + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _ EVALUATE_SH_VERTEX + #pragma multi_compile _ EVALUATE_SH_MIXED + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outColor : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #elif defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2) + #if UNITY_VERSION >= 60000009 + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos, IN.probeOcclusion, inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos); + #endif + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + outColor = color; + + #ifdef _WRITE_RENDERING_LAYERS + #if UNITY_VERSION >= 60020000 + outRenderingLayers = EncodeMeshRenderingLayer(); + #else + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + #endif + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + + } + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader.meta new file mode 100644 index 00000000..120912d8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 86ce7e600deb17e429b8be445bb652f7 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLit.shader + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader new file mode 100644 index 00000000..082441b4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader @@ -0,0 +1,5252 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: URP2023 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW + #pragma multi_compile_fragment _ _SHADOWS_SOFT_MEDIUM + #pragma multi_compile_fragment _ _SHADOWS_SOFT_HIGH + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _ EVALUATE_SH_VERTEX + #pragma multi_compile _ EVALUATE_SH_MIXED + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outColor : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #elif defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2) + #if UNITY_VERSION >= 60000009 + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos, IN.probeOcclusion, inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos); + #endif + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + outColor = color; + + #ifdef _WRITE_RENDERING_LAYERS + #if UNITY_VERSION >= 60020000 + outRenderingLayers = EncodeMeshRenderingLayer(); + #else + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + #endif + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + + } + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader.meta new file mode 100644 index 00000000..05cffd88 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 4cab4aa8ce3e6774aa0d904ec70df88e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderLitTransparent.shader + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderSRPBatch.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderSRPBatch.shader new file mode 100644 index 00000000..8ab45dd2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderSRPBatch.shader @@ -0,0 +1,350 @@ +Shader "AllIn1SpriteShader/AllIn1SpriteShaderSRPBatch" +{ + Properties + { + [NoScaleOffset]_MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset]_FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + [NoScaleOffset]_FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + [NoScaleOffset]_OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset]_OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset]_DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 0.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset]_OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //179 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + } + + SubShader + { + PackageRequirements + { + "com.unity.render-pipelines.high-definition" : "12.1" + } + + Tags { "Queue" = "Transparent" "CanUseSpriteAtlas" = "True" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" } + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + Pass + { + HLSLPROGRAM + #pragma target 4.5 + #pragma multi_compile_instancing + #pragma vertex vert + #pragma fragment frag + + #define HDRP_PASS + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/AtmosphericScattering.hlsl" + + #include "ShaderLibrary/AllIn1SpriteShaderSRP_CommonFunctions.hlsl" + #include "ShaderLibrary/AllIn1SpriteShaderSRP_HDRPHelper.hlsl" + + #include "ShaderLibrary/AllIn1SpriteShaderSRP_Structs.hlsl" + #include_with_pragmas "ShaderLibrary/AllIn1SpriteShaderSRP_ShaderFeatures.hlsl" + #include "ShaderLibrary/AllIn1SpriteShaderSRP_Properties.hlsl" + #include "ShaderLibrary/AllIn1SpriteShaderSRP_VertexPass.hlsl" + #include "ShaderLibrary/AllIn1SpriteShaderSRP_FragmentPass.hlsl" + + + + #if FOG_ON + #pragma multi_compile_fog + #endif + + ENDHLSL + } + } + + SubShader + { + PackageRequirements + { + "com.unity.render-pipelines.universal" : "12.0" + } + + Tags { "Queue" = "Transparent" "CanUseSpriteAtlas" = "True" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" } + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + Pass + { + HLSLPROGRAM + #pragma multi_compile_instancing + #pragma vertex vert + #pragma fragment frag + + #define URP_PASS + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + + #include "ShaderLibrary/AllIn1SpriteShaderSRP_CommonFunctions.hlsl" + #include "ShaderLibrary/AllIn1SpriteShaderSRP_URPHelper.hlsl" + + #include "ShaderLibrary/AllIn1SpriteShaderSRP_Structs.hlsl" + #include_with_pragmas "ShaderLibrary/AllIn1SpriteShaderSRP_ShaderFeatures.hlsl" + #include "ShaderLibrary/AllIn1SpriteShaderSRP_Properties.hlsl" + #include "ShaderLibrary/AllIn1SpriteShaderSRP_VertexPass.hlsl" + #include "ShaderLibrary/AllIn1SpriteShaderSRP_FragmentPass.hlsl" + + + + #if FOG_ON + #pragma multi_compile_fog + #endif + + ENDHLSL + } + } + + //Fallback "AllIn1SpriteShader/AllIn1SpriteShader" + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderMaterialInspector" +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderSRPBatch.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderSRPBatch.shader.meta new file mode 100644 index 00000000..277d9742 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderSRPBatch.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 7e09cd2cd29cb3c45b69adf230c51ae0 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderSRPBatch.shader + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader new file mode 100644 index 00000000..6f60544b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader @@ -0,0 +1,1236 @@ +Shader "AllIn1SpriteShader/AllIn1SpriteShaderScaledTime" +{ + Properties + { + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 0.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //172 + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + } + + SubShader + { + Tags { "Queue" = "Transparent" "CanUseSpriteAtlas" = "True" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" } + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_instancing + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHAROUND_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature ATLAS_ON + #pragma shader_feature PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + #pragma shader_feature FOG_ON + + #include "UnityCG.cginc" + #include "AllIn1OneShaderFunctions.cginc" + + #if FOG_ON + #pragma multi_compile_fog + #endif + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + half4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + half4 color : COLOR; + #if OUTTEX_ON + half2 uvOutTex : TEXCOORD1; + #endif + #if OUTDIST_ON + half2 uvOutDistTex : TEXCOORD2; + #endif + #if DISTORT_ON + half2 uvDistTex : TEXCOORD3; + #endif + #if FOG_ON + UNITY_FOG_COORDS(4) + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + float globalUnscaledTime; + + sampler2D _MainTex; + half4 _MainTex_ST, _MainTex_TexelSize, _Color; + half _Alpha; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if FADE_ON + sampler2D _FadeTex, _FadeBurnTex; + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if GLOW_ON + sampler2D _GlowTex; + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + sampler2D _OutlineTex; + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + sampler2D _OutlineDistortTex; + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if DISTORT_ON + sampler2D _DistortTex; + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + sampler2D _ColorSwapTex; + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if COLORRAMP_ON + sampler2D _ColorRampTex, _ColorRampTexGradient; + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + sampler2D _ShineMask; + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if ALPHACUTOFF_ON + half _AlphaCutoffValue; + #endif + + #if ALPHAROUND_ON + half _AlphaRoundThreshold; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + sampler2D _OverlayTex; + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + UNITY_INSTANCING_BUFFER_START(Props) + UNITY_DEFINE_INSTANCED_PROP(float, _RandomSeed) + UNITY_INSTANCING_BUFFER_END(Props) + + v2f vert (appdata v) + { + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + o.vertex = UnityObjectToClipPos(half4(localPos, 1)); + #else + o.vertex = UnityObjectToClipPos(v.vertex); + #endif + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + #if POLARUV_ON + o.uv = v.uv - center; + #endif + + #if ROTATEUV_ON + half2 uvC = v.uv; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + o.uv = mul(rot, uvC); + o.uv += center; + #endif + + #if OUTTEX_ON + o.uvOutTex = TRANSFORM_TEX(v.uv, _OutlineTex); + #endif + + #if OUTDIST_ON + o.uvOutDistTex = TRANSFORM_TEX(v.uv, _OutlineDistortTex); + #endif + + #if DISTORT_ON + o.uvDistTex = TRANSFORM_TEX(v.uv, _DistortTex); + #endif + + #if FOG_ON + UNITY_TRANSFER_FOG(o,o.vertex); + #endif + + return o; + } + + half3 GetPixel(in int offsetX, in int offsetY, half2 uv, sampler2D tex) + { + return tex2D(tex, (uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y))).rgb; + } + + half4 frag (v2f i) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + half randomSeed = UNITY_ACCESS_INSTANCED_PROP(Props, _RandomSeed); + + float2 uvRect = i.uv; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((i.uv.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + #if CLIPPING_ON + half2 tiledUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + #if TEXTURESCROLL_ON && ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((((globalUnscaledTime * 20) + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs((((globalUnscaledTime * 20) + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + + #if OFFSETUV_ON + #if ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + i.uv += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + #if POLARUV_ON + i.uv = half2(atan2(i.uv.y, i.uv.x) / (2.0f * 3.141592653589f), length(i.uv)); + i.uv *= _MainTex_ST.xy; + #endif + + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = i.uv - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + i.uv = tempUv; + #endif + + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = i.uv - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + i.uv = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + + #if PINCH_ON + half2 dP = i.uv - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + i.uv = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + #if ZOOMUV_ON + i.uv -= centerTiled; + i.uv = i.uv * _ZoomUvAmount; + i.uv += centerTiled; + #endif + + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor(((globalUnscaledTime * 20) + randomSeed) * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + i.uv = lerp(i.uv, i.uv + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((globalUnscaledTime + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((globalUnscaledTime + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + i.uv += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if RECTSIZE_ON + i.uv = i.uv.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + #if DISTORT_ON + #if ATLAS_ON + i.uvDistTex.x = i.uvDistTex.x * (1 / (_MaxXUV - _MinXUV)); + i.uvDistTex.y = i.uvDistTex.y * (1 / (_MaxYUV - _MinYUV)); + #endif + i.uvDistTex.x += ((globalUnscaledTime + randomSeed) * _DistortTexXSpeed) % 1; + i.uvDistTex.y += ((globalUnscaledTime + randomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (tex2D(_DistortTex, i.uvDistTex).r - 0.5) * 0.2 * _DistortAmount; + i.uv.x += distortAmnt; + i.uv.y += distortAmnt; + #endif + + #if WARP_ON + half2 warpUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = ((globalUnscaledTime * 20) + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = ((globalUnscaledTime * 20) + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + i.uv += warp; + #endif + + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - i.uv; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = (globalUnscaledTime * 20) + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + i.uv = i.uv + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + i.uv += (sin((ripple + ((globalUnscaledTime * 20) + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if WIND_ON + half windOffset = sin((globalUnscaledTime + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = i.uv - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + i.uv = i.uv + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + #if TEXTURESCROLL_ON && !ATLAS_ON + i.uv.x += (((globalUnscaledTime * 20) + randomSeed) * _TextureScrollXSpeed) % 1; + i.uv.y += (((globalUnscaledTime * 20) + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + i.uv = floor(i.uv * pixelSize) / pixelSize; + #endif + + half4 col = tex2D(_MainTex, i.uv); + half originalAlpha = col.a; + col *= i.color; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2CustomTime(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, globalUnscaledTime, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2CustomTime(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, globalUnscaledTime, _GlitchSpeed), 3.0); + col = tex2D(_MainTex, i.uv + half2(lineNoise * 0.02 * rand2CustomTime(half2(2.0, 1), randomSeed, globalUnscaledTime, _GlitchSpeed), 0)) * i.color; + #endif + + #if CHROMABERR_ON + half4 r = tex2D(_MainTex, i.uv + half2(_ChromAberrAmount/10, 0)) * i.color; + half4 b = tex2D(_MainTex, i.uv + half2(-_ChromAberrAmount/10, 0)) * i.color; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * i.color; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, 1, 1) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity) * i.color; + #endif + #endif + #endif + + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + half luminance = 0; + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, i.uv, _MainTex) - GetPixel(0, -_InnerOutlineThickness, i.uv, _MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, i.uv, _MainTex) - GetPixel(-_InnerOutlineThickness, 0, i.uv, _MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = tex2D(_ColorSwapTex, i.uv); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if CHANGECOLOR_ON + float3 currChangeColor = col.rgb; + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if OVERLAY_ON + half2 overlayUvs = uvRect; + overlayUvs.x += (((globalUnscaledTime * 20) + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += (((globalUnscaledTime * 20) + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = tex2D(_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //OUTLINE------------------------------------------------------------- + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + half2 uvOutDist = uvRect; + uvOutDist.x += ((globalUnscaledTime + randomSeed) * _OutlineDistortTexXSpeed) % 1; + uvOutDist.y += ((globalUnscaledTime + randomSeed) * _OutlineDistortTexYSpeed) % 1; + half outDistortAmnt = (tex2D(_OutlineDistortTex, TRANSFORM_TEX(uvOutDist, _OutlineDistortTex)).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = tex2D(_MainTex, i.uv + half2(destUv.x, 0)).a; + half spriteRight = tex2D(_MainTex, i.uv - half2(destUv.x, 0)).a; + half spriteBottom = tex2D(_MainTex, i.uv + half2(0, destUv.y)).a; + half spriteTop = tex2D(_MainTex, i.uv - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = tex2D(_MainTex, i.uv + half2(destUv.x, destUv.y)).a; + half spriteTopRight = tex2D(_MainTex, i.uv + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = tex2D(_MainTex, i.uv + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = tex2D(_MainTex, i.uv + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + i.uvOutTex.x += ((globalUnscaledTime + randomSeed) * _OutlineTexXSpeed) % 1; + i.uvOutTex.y += ((globalUnscaledTime + randomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutTex = half2((i.uvOutTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = tex2D(_OutlineTex, i.uvOutTex); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * i.color.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //----------------------------------------------------------------------------- + + #if FADE_ON + half2 tiledUvFade1= TRANSFORM_TEX(i.uv, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(i.uv, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = tex2D(_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * tex2D(_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + + #if SHADOW_ON + half shadowA = tex2D(_MainTex, i.uv + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * i.color.a, col.a); + #endif + + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = tex2D(_GlowTex, i.uv); + #else + emission = col; + #endif + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = tex2D(_ShineMask, i.uv).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((globalUnscaledTime + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + ((globalUnscaledTime * 60) + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + + col.a *= _Alpha; + + #if ALPHACUTOFF_ON + clip((1 - _AlphaCutoffValue) - (1 - col.a) - 0.01); + #endif + + #if ALPHAROUND_ON + col.a = step(_AlphaRoundThreshold, col.a); + #endif + + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + + col *= _Color; + + #if FOG_ON + UNITY_APPLY_FOG(i.fogCoord, col); + #endif + + return col; + } + ENDCG + } + } + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderMaterialInspector" + //Fallback "Sprites/Default" //Remove fallback so that any shader error is obvious to the user +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader.meta new file mode 100644 index 00000000..898e6737 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader.meta @@ -0,0 +1,28 @@ +fileFormatVersion: 2 +guid: f3622b3ac1631ea409b0f5811034f3a9 +ShaderImporter: + externalObjects: {} + defaultTextures: + - _MainTex: {instanceID: 0} + - _GlowTex: {instanceID: 0} + - _FadeTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _FadeBurnTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + - _OutlineTex: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + - _OutlineDistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _ColorSwapTex: {instanceID: 0} + - _ColorRampTex: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + - _DistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _ShineMask: {instanceID: 0} + - _ColorRampTexGradient: {instanceID: 0} + - _OverlayTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderScaledTime.shader + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader new file mode 100644 index 00000000..855a1653 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader @@ -0,0 +1,1247 @@ +Shader "AllIn1SpriteShader/AllIn1SpriteShaderUiMask" +{ + Properties + { + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 0.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //172 + + _Stencil ("Stencil ID", Float) = 0 + _StencilComp ("Stencil Comparison", Float) = 8 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + _ColorMask ("Color Mask", Float) = 15 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + } + + SubShader + { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" } + Blend [_MySrcMode] [_MyDstMode] + Cull Off + ZWrite Off + ZTest [unity_GUIZTestMode] + ColorMask [_ColorMask] + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_instancing + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHAROUND_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature ATLAS_ON + #pragma shader_feature PREMULTIPLYALPHA_ON + + #pragma multi_compile _ UNITY_UI_CLIP_RECT + #pragma multi_compile _ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "AllIn1OneShaderFunctions.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + half4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + half4 color : COLOR; + #if OUTTEX_ON + half2 uvOutTex : TEXCOORD1; + #endif + #if OUTDIST_ON + half2 uvOutDistTex : TEXCOORD2; + #endif + #if DISTORT_ON + half2 uvDistTex : TEXCOORD3; + #endif + #if UNITY_UI_CLIP_RECT + half4 mask : TEXCOORD4; + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #if UNITY_UI_CLIP_RECT + float4 _ClipRect; + half _UIMaskSoftnessX, _UIMaskSoftnessY; + #endif + + sampler2D _MainTex; + half4 _MainTex_ST, _MainTex_TexelSize, _Color; + half _Alpha; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if FADE_ON + sampler2D _FadeTex, _FadeBurnTex; + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if GLOW_ON + sampler2D _GlowTex; + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + sampler2D _OutlineTex; + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + sampler2D _OutlineDistortTex; + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if DISTORT_ON + sampler2D _DistortTex; + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + sampler2D _ColorSwapTex; + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if COLORRAMP_ON + sampler2D _ColorRampTex, _ColorRampTexGradient; + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + sampler2D _ShineMask; + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if ALPHACUTOFF_ON + half _AlphaCutoffValue; + #endif + + #if ALPHAROUND_ON + half _AlphaRoundThreshold; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + sampler2D _OverlayTex; + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + UNITY_INSTANCING_BUFFER_START(Props) + UNITY_DEFINE_INSTANCED_PROP(float, _RandomSeed) + UNITY_INSTANCING_BUFFER_END(Props) + + v2f vert(appdata v) + { + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + + #if UNITY_UI_CLIP_RECT + half2 pixelSize = o.vertex.w; + pixelSize /= half2(1, 1) * abs(mul((half2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + half4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + half2 maskUV = (v.vertex.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + o.mask = half4(v.vertex.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_UIMaskSoftnessX, _UIMaskSoftnessY) + abs(pixelSize.xy))); + #endif + + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + #if POLARUV_ON + o.uv = v.uv - center; + #endif + + #if ROTATEUV_ON + half2 uvC = v.uv; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + o.uv = mul(rot, uvC); + o.uv += center; + #endif + + #if OUTTEX_ON + o.uvOutTex = TRANSFORM_TEX(v.uv, _OutlineTex); + #endif + + #if OUTDIST_ON + o.uvOutDistTex = TRANSFORM_TEX(v.uv, _OutlineDistortTex); + #endif + + #if DISTORT_ON + o.uvDistTex = TRANSFORM_TEX(v.uv, _DistortTex); + #endif + + return o; + } + + half3 GetPixel(in int offsetX, in int offsetY, half2 uv, sampler2D tex) + { + return tex2D(tex, (uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y))).rgb; + } + + half4 frag(v2f i) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + half randomSeed = UNITY_ACCESS_INSTANCED_PROP(Props, _RandomSeed); + + float2 uvRect = i.uv; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((i.uv.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + #if CLIPPING_ON + half2 tiledUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + #if TEXTURESCROLL_ON && ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + + #if OFFSETUV_ON + #if ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + i.uv += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + #if POLARUV_ON + i.uv = half2(atan2(i.uv.y, i.uv.x) / (2.0f * 3.141592653589f), length(i.uv)); + i.uv *= _MainTex_ST.xy; + #endif + + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = i.uv - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + i.uv = tempUv; + #endif + + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = i.uv - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + i.uv = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + + #if PINCH_ON + half2 dP = i.uv - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + i.uv = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + #if ZOOMUV_ON + i.uv -= centerTiled; + i.uv = i.uv * _ZoomUvAmount; + i.uv += centerTiled; + #endif + + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + i.uv = lerp(i.uv, i.uv + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + i.uv += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if RECTSIZE_ON + i.uv = i.uv.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + #if DISTORT_ON + #if ATLAS_ON + i.uvDistTex.x = i.uvDistTex.x * (1 / (_MaxXUV - _MinXUV)); + i.uvDistTex.y = i.uvDistTex.y * (1 / (_MaxYUV - _MinYUV)); + #endif + i.uvDistTex.x += ((_Time.x + randomSeed) * _DistortTexXSpeed) % 1; + i.uvDistTex.y += ((_Time.x + randomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (tex2D(_DistortTex, i.uvDistTex).r - 0.5) * 0.2 * _DistortAmount; + i.uv.x += distortAmnt; + i.uv.y += distortAmnt; + #endif + + #if WARP_ON + half2 warpUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + i.uv += warp; + #endif + + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - i.uv; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + i.uv = i.uv + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + i.uv += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = i.uv - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + i.uv = i.uv + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + #if TEXTURESCROLL_ON && !ATLAS_ON + i.uv.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + i.uv.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + i.uv = floor(i.uv * pixelSize) / pixelSize; + #endif + + half4 col = tex2D(_MainTex, i.uv); + half originalAlpha = col.a; + col *= i.color; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = tex2D(_MainTex, i.uv + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * i.color; + #endif + + #if CHROMABERR_ON + half4 r = tex2D(_MainTex, i.uv + half2(_ChromAberrAmount/10, 0)) * i.color; + half4 b = tex2D(_MainTex, i.uv + half2(-_ChromAberrAmount/10, 0)) * i.color; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * i.color; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, 1, 1) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity) * i.color; + #endif + #endif + #endif + + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + half luminance = 0; + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, i.uv, _MainTex) - GetPixel(0, -_InnerOutlineThickness, i.uv, _MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, i.uv, _MainTex) - GetPixel(-_InnerOutlineThickness, 0, i.uv, _MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = tex2D(_ColorSwapTex, i.uv); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if OVERLAY_ON + half2 overlayUvs = uvRect; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = tex2D(_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //OUTLINE------------------------------------------------------------- + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + half2 uvOutDist = uvRect; + uvOutDist.x += ((_Time.x + randomSeed) * _OutlineDistortTexXSpeed) % 1; + uvOutDist.y += ((_Time.x + randomSeed) * _OutlineDistortTexYSpeed) % 1; + half outDistortAmnt = (tex2D(_OutlineDistortTex, TRANSFORM_TEX(uvOutDist, _OutlineDistortTex)).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = tex2D(_MainTex, i.uv + half2(destUv.x, 0)).a; + half spriteRight = tex2D(_MainTex, i.uv - half2(destUv.x, 0)).a; + half spriteBottom = tex2D(_MainTex, i.uv + half2(0, destUv.y)).a; + half spriteTop = tex2D(_MainTex, i.uv - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = tex2D(_MainTex, i.uv + half2(destUv.x, destUv.y)).a; + half spriteTopRight = tex2D(_MainTex, i.uv + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = tex2D(_MainTex, i.uv + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = tex2D(_MainTex, i.uv + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + i.uvOutTex.x += ((_Time.x + randomSeed) * _OutlineTexXSpeed) % 1; + i.uvOutTex.y += ((_Time.x + randomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutTex = half2((i.uvOutTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = tex2D(_OutlineTex, i.uvOutTex); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * i.color.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //----------------------------------------------------------------------------- + + #if FADE_ON + half2 tiledUvFade1= TRANSFORM_TEX(i.uv, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(i.uv, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = tex2D(_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * tex2D(_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + + #if SHADOW_ON + half shadowA = tex2D(_MainTex, i.uv + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * i.color.a, col.a); + #endif + + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = tex2D(_GlowTex, i.uv); + #else + emission = col; + #endif + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = tex2D(_ShineMask, i.uv).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + + col.a *= _Alpha; + + #if UNITY_UI_CLIP_RECT + half2 clipMask = saturate((_ClipRect.zw - _ClipRect.xy - abs(i.mask.xy)) * i.mask.zw); + col.a *= clipMask.x * clipMask.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip (col.a - 0.001); + #endif + + #if ALPHACUTOFF_ON + clip((1 - _AlphaCutoffValue) - (1 - col.a) - 0.01); + #endif + + #if ALPHAROUND_ON + col.a = step(_AlphaRoundThreshold, col.a); + #endif + + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + + col *= _Color; + + return col; + } + ENDCG + } + } + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderUiMaskMaterialInspector" + //Fallback "Sprites/Default" //Remove fallback so that any shader error is obvious to the user +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader.meta new file mode 100644 index 00000000..31a84084 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader.meta @@ -0,0 +1,28 @@ +fileFormatVersion: 2 +guid: a53f4bb29f3644b43b5075c6dcfecb32 +ShaderImporter: + externalObjects: {} + defaultTextures: + - _MainTex: {instanceID: 0} + - _GlowTex: {instanceID: 0} + - _FadeTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _FadeBurnTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + - _OutlineTex: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + - _OutlineDistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _ColorSwapTex: {instanceID: 0} + - _ColorRampTex: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + - _DistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _ShineMask: {instanceID: 0} + - _ColorRampTexGradient: {instanceID: 0} + - _OverlayTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMask.shader + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader new file mode 100644 index 00000000..d45c7102 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader @@ -0,0 +1,1249 @@ +Shader "AllIn1SpriteShader/AllIn1SpriteShaderUiMaskScaledTime" +{ + Properties + { + _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 0.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //172 + + _Stencil ("Stencil ID", Float) = 0 + _StencilComp ("Stencil Comparison", Float) = 8 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + _ColorMask ("Color Mask", Float) = 15 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 6 + } + + SubShader + { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" } + Blend [_MySrcMode] [_MyDstMode] + Cull Off + ZWrite Off + ZTest [unity_GUIZTestMode] + ColorMask [_ColorMask] + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_instancing + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHAROUND_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature ATLAS_ON + #pragma shader_feature PREMULTIPLYALPHA_ON + + #pragma multi_compile _ UNITY_UI_CLIP_RECT + #pragma multi_compile _ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "AllIn1OneShaderFunctions.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + half4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + half4 color : COLOR; + #if OUTTEX_ON + half2 uvOutTex : TEXCOORD1; + #endif + #if OUTDIST_ON + half2 uvOutDistTex : TEXCOORD2; + #endif + #if DISTORT_ON + half2 uvDistTex : TEXCOORD3; + #endif + #if UNITY_UI_CLIP_RECT + half4 mask : TEXCOORD4; + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #if UNITY_UI_CLIP_RECT + float4 _ClipRect; + half _UIMaskSoftnessX, _UIMaskSoftnessY; + #endif + + float globalUnscaledTime; + + sampler2D _MainTex; + half4 _MainTex_ST, _MainTex_TexelSize, _Color; + half _Alpha; + + #if ATLAS_ON + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + #endif + + #if RECTSIZE_ON + half _RectSize; + #endif + + #if OFFSETUV_ON + half _OffsetUvX, _OffsetUvY; + #endif + + #if CLIPPING_ON + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + #endif + + #if RADIALCLIPPING_ON + half _RadialStartAngle, _RadialClip, _RadialClip2; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if ROTATEUV_ON + half _RotateUvAmount; + #endif + + #if FISHEYE_ON + half _FishEyeUvAmount; + #endif + + #if PINCH_ON + half _PinchUvAmount; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if ZOOMUV_ON + half _ZoomUvAmount; + #endif + + #if FADE_ON + sampler2D _FadeTex, _FadeBurnTex; + half4 _FadeBurnColor, _FadeTex_ST, _FadeBurnTex_ST; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if GLOW_ON + sampler2D _GlowTex; + half4 _GlowColor; + half _Glow, _GlowGlobal; + #endif + + #if OUTBASE_ON + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + #endif + + #if OUTTEX_ON + sampler2D _OutlineTex; + half4 _OutlineTex_ST; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + #endif + + #if OUTDIST_ON + sampler2D _OutlineDistortTex; + half4 _OutlineDistortTex_ST; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + #endif + + #if DISTORT_ON + sampler2D _DistortTex; + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if WARP_ON + half _WarpStrength, _WarpSpeed, _WarpScale; + #endif + + #if WIND_ON + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + #endif + + #if GRADIENT_ON + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + #endif + + #if COLORSWAP_ON + sampler2D _ColorSwapTex; + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if HITEFFECT_ON + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if NEGATIVE_ON + half _NegativeAmount; + #endif + + #if COLORRAMP_ON + sampler2D _ColorRampTex, _ColorRampTexGradient; + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if GREYSCALE_ON + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors, _PosterizeGamma; + #endif + + #if BLUR_ON + half _BlurIntensity; + #endif + + #if MOTIONBLUR_ON + half _MotionBlurAngle, _MotionBlurDist; + #endif + + #if GHOST_ON + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + #endif + + #if ALPHAOUTLINE_ON + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + #endif + + #if INNEROUTLINE_ON + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + #endif + + #if HOLOGRAM_ON + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + #endif + + #if CHROMABERR_ON + half _ChromAberrAmount, _ChromAberrAlpha; + #endif + + #if GLITCH_ON + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + #endif + + #if FLICKER_ON + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + #endif + + #if SHADOW_ON + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + #endif + + #if SHINE_ON + sampler2D _ShineMask; + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + #endif + + #if ALPHACUTOFF_ON + half _AlphaCutoffValue; + #endif + + #if ALPHAROUND_ON + half _AlphaRoundThreshold; + #endif + + #if CHANGECOLOR_ON + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + #endif + #if CHANGECOLOR2_ON + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + #endif + #if CHANGECOLOR3_ON + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + #endif + + #if CONTRAST_ON + half _Contrast, _Brightness; + #endif + + #if OVERLAY_ON + sampler2D _OverlayTex; + half4 _OverlayTex_ST, _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + #endif + + UNITY_INSTANCING_BUFFER_START(Props) + UNITY_DEFINE_INSTANCED_PROP(float, _RandomSeed) + UNITY_INSTANCING_BUFFER_END(Props) + + v2f vert(appdata v) + { + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + o.color = v.color; + + #if UNITY_UI_CLIP_RECT + half2 pixelSize = o.vertex.w; + pixelSize /= half2(1, 1) * abs(mul((half2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + half4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + half2 maskUV = (v.vertex.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + o.mask = half4(v.vertex.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_UIMaskSoftnessX, _UIMaskSoftnessY) + abs(pixelSize.xy))); + #endif + + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + #if POLARUV_ON + o.uv = v.uv - center; + #endif + + #if ROTATEUV_ON + half2 uvC = v.uv; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + o.uv = mul(rot, uvC); + o.uv += center; + #endif + + #if OUTTEX_ON + o.uvOutTex = TRANSFORM_TEX(v.uv, _OutlineTex); + #endif + + #if OUTDIST_ON + o.uvOutDistTex = TRANSFORM_TEX(v.uv, _OutlineDistortTex); + #endif + + #if DISTORT_ON + o.uvDistTex = TRANSFORM_TEX(v.uv, _DistortTex); + #endif + + return o; + } + + half3 GetPixel(in int offsetX, in int offsetY, half2 uv, sampler2D tex) + { + return tex2D(tex, (uv + half2(offsetX * _MainTex_TexelSize.x, offsetY * _MainTex_TexelSize.y))).rgb; + } + + half4 frag(v2f i) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + half randomSeed = UNITY_ACCESS_INSTANCED_PROP(Props, _RandomSeed); + + float2 uvRect = i.uv; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((i.uv.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ST.x, center.y * _MainTex_ST.y); + + #if CLIPPING_ON + half2 tiledUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + #if TEXTURESCROLL_ON && ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((((globalUnscaledTime * 20) + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs((((globalUnscaledTime * 20) + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + + #if OFFSETUV_ON + #if ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + i.uv += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + #if POLARUV_ON + i.uv = half2(atan2(i.uv.y, i.uv.x) / (2.0f * 3.141592653589f), length(i.uv)); + i.uv *= _MainTex_ST.xy; + #endif + + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = i.uv - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + i.uv = tempUv; + #endif + + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = i.uv - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + i.uv = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + + #if PINCH_ON + half2 dP = i.uv - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + i.uv = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + #if ZOOMUV_ON + i.uv -= centerTiled; + i.uv = i.uv * _ZoomUvAmount; + i.uv += centerTiled; + #endif + + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((globalUnscaledTime + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + i.uv = lerp(i.uv, i.uv + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((globalUnscaledTime + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((globalUnscaledTime + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + i.uv += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if RECTSIZE_ON + i.uv = i.uv.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + #if DISTORT_ON + #if ATLAS_ON + i.uvDistTex.x = i.uvDistTex.x * (1 / (_MaxXUV - _MinXUV)); + i.uvDistTex.y = i.uvDistTex.y * (1 / (_MaxYUV - _MinYUV)); + #endif + i.uvDistTex.x += ((globalUnscaledTime + randomSeed) * _DistortTexXSpeed) % 1; + i.uvDistTex.y += ((globalUnscaledTime + randomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (tex2D(_DistortTex, i.uvDistTex).r - 0.5) * 0.2 * _DistortAmount; + i.uv.x += distortAmnt; + i.uv.y += distortAmnt; + #endif + + #if WARP_ON + half2 warpUv = half2(i.uv.x / _MainTex_ST.x, i.uv.y / _MainTex_ST.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = ((globalUnscaledTime * 20) + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = ((globalUnscaledTime * 20) + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + i.uv += warp; + #endif + + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - i.uv; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = (globalUnscaledTime * 20) + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + i.uv = i.uv + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ST.y) - uvRect.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + i.uv += (sin((ripple + ((globalUnscaledTime * 20) + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if WIND_ON + half windOffset = sin((globalUnscaledTime + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = i.uv - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + i.uv = i.uv + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + #if TEXTURESCROLL_ON && !ATLAS_ON + i.uv.x += (((globalUnscaledTime * 20) + randomSeed) * _TextureScrollXSpeed) % 1; + i.uv.y += (((globalUnscaledTime * 20) + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + i.uv = floor(i.uv * pixelSize) / pixelSize; + #endif + + half4 col = tex2D(_MainTex, i.uv); + half originalAlpha = col.a; + col *= i.color; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2CustomTime(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, globalUnscaledTime, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2CustomTime(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, globalUnscaledTime, _GlitchSpeed), 3.0); + col = tex2D(_MainTex, i.uv + half2(lineNoise * 0.02 * rand2CustomTime(half2(2.0, 1), randomSeed, globalUnscaledTime, _GlitchSpeed), 0)) * i.color; + #endif + + #if CHROMABERR_ON + half4 r = tex2D(_MainTex, i.uv + half2(_ChromAberrAmount/10, 0)) * i.color; + half4 b = tex2D(_MainTex, i.uv + half2(-_ChromAberrAmount/10, 0)) * i.color; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * i.color; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, _BlurIntensity, 1, 1) * i.color; + #else + col = Blur(i.uv, _MainTex, _BlurIntensity) * i.color; + #endif + #endif + #endif + + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += tex2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + half luminance = 0; + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, i.uv, _MainTex) - GetPixel(0, -_InnerOutlineThickness, i.uv, _MainTex)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, i.uv, _MainTex) - GetPixel(-_InnerOutlineThickness, 0, i.uv, _MainTex)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ST.x, uvRect.y / _MainTex_ST.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = tex2D(_ColorSwapTex, i.uv); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if OVERLAY_ON + half2 overlayUvs = uvRect; + overlayUvs.x += (((globalUnscaledTime * 20) + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += (((globalUnscaledTime * 20) + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = tex2D(_OverlayTex, TRANSFORM_TEX(overlayUvs, _OverlayTex)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //OUTLINE------------------------------------------------------------- + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * _MainTex_TexelSize.x, _OutlinePixelWidth * _MainTex_TexelSize.y); + #else + half2 destUv = half2(_OutlineWidth * _MainTex_TexelSize.x * 200, _OutlineWidth * _MainTex_TexelSize.y * 200); + #endif + + #if OUTDIST_ON + half2 uvOutDist = uvRect; + uvOutDist.x += ((globalUnscaledTime + randomSeed) * _OutlineDistortTexXSpeed) % 1; + uvOutDist.y += ((globalUnscaledTime + randomSeed) * _OutlineDistortTexYSpeed) % 1; + half outDistortAmnt = (tex2D(_OutlineDistortTex, TRANSFORM_TEX(uvOutDist, _OutlineDistortTex)).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = tex2D(_MainTex, i.uv + half2(destUv.x, 0)).a; + half spriteRight = tex2D(_MainTex, i.uv - half2(destUv.x, 0)).a; + half spriteBottom = tex2D(_MainTex, i.uv + half2(0, destUv.y)).a; + half spriteTop = tex2D(_MainTex, i.uv - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = tex2D(_MainTex, i.uv + half2(destUv.x, destUv.y)).a; + half spriteTopRight = tex2D(_MainTex, i.uv + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = tex2D(_MainTex, i.uv + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = tex2D(_MainTex, i.uv + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + i.uvOutTex.x += ((globalUnscaledTime + randomSeed) * _OutlineTexXSpeed) % 1; + i.uvOutTex.y += ((globalUnscaledTime + randomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutTex = half2((i.uvOutTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = tex2D(_OutlineTex, i.uvOutTex); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * i.color.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //----------------------------------------------------------------------------- + + #if FADE_ON + half2 tiledUvFade1= TRANSFORM_TEX(i.uv, _FadeTex); + half2 tiledUvFade2 = TRANSFORM_TEX(i.uv, _FadeBurnTex); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = tex2D(_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * tex2D(_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + + #if SHADOW_ON + half shadowA = tex2D(_MainTex, i.uv + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * i.color.a, col.a); + #endif + + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = tex2D(_GlowTex, i.uv); + #else + emission = col; + #endif + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = tex2D(_ShineMask, i.uv).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((globalUnscaledTime + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + ((globalUnscaledTime * 60) + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + + col.a *= _Alpha; + + #if UNITY_UI_CLIP_RECT + half2 clipMask = saturate((_ClipRect.zw - _ClipRect.xy - abs(i.mask.xy)) * i.mask.zw); + col.a *= clipMask.x * clipMask.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip (col.a - 0.001); + #endif + + #if ALPHACUTOFF_ON + clip((1 - _AlphaCutoffValue) - (1 - col.a) - 0.01); + #endif + + #if ALPHAROUND_ON + col.a = step(_AlphaRoundThreshold, col.a); + #endif + + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + + col *= _Color; + + return col; + } + ENDCG + } + } + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderUiMaskMaterialInspector" + //Fallback "Sprites/Default" //Remove fallback so that any shader error is obvious to the user +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader.meta new file mode 100644 index 00000000..900de6a6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader.meta @@ -0,0 +1,28 @@ +fileFormatVersion: 2 +guid: e89361f7792fee34fbaa655df899c819 +ShaderImporter: + externalObjects: {} + defaultTextures: + - _MainTex: {instanceID: 0} + - _GlowTex: {instanceID: 0} + - _FadeTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _FadeBurnTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + - _OutlineTex: {fileID: 2800000, guid: 74087f6d03f233e4a8a142fa01f9e5cf, type: 3} + - _OutlineDistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _ColorSwapTex: {instanceID: 0} + - _ColorRampTex: {fileID: 2800000, guid: 279657edc397ece4b8029c727adf6ddc, type: 3} + - _DistortTex: {fileID: 2800000, guid: 7aad8c583ef292e48b06af0d1f2fab97, type: 3} + - _ShineMask: {instanceID: 0} + - _ColorRampTexGradient: {instanceID: 0} + - _OverlayTex: {fileID: 2800000, guid: 677cca399782dea41aedc1d292ecb67d, type: 3} + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1SpriteShaderUiMaskScaledTime.shader + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1Urp2dRenderer.shader b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1Urp2dRenderer.shader new file mode 100644 index 00000000..9744163b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1Urp2dRenderer.shader @@ -0,0 +1,466 @@ +Shader "AllIn1SpriteShader/AllIn1Urp2dRenderer" +{ + Properties + { + [NoScaleOffset]_MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset]_FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + [NoScaleOffset]_FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + [NoScaleOffset]_OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset]_OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset]_DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 0.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset]_OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + _MaskTex("Lighting Mask", 2D) = "white" {} //172 + _LitAmount("Lit Amount", Range(0,1)) = 1 //173 + _NormalMap("Normal Map", 2D) = "bump" {} //174 + _NormalStrength("Normal Strength", Range(0,10)) = 1 //175 + [Toggle()] _GlowAffectLight("Glow affects light", Float) = 1 //176 + + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //179 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //180 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //181 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //182 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //183 + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //184 + /**/ + + + _ZTestMode ("Z Test Mode", Float) = 4 + _CullingOption ("Culling Option", float) = 0 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 + _EditorDrawers("Editor Drawers", Int) = 14 + } + + + SubShader + { + PackageRequirements + { + "com.unity.render-pipelines.universal" : "[12.0,17.2]" + } + + Tags {"Queue" = "Transparent" "RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline" "CanUseSpriteAtlas" = "True" "PreviewType" = "Plane" "RenderPipeline"="UniversalPipeline"} + Blend [_MySrcMode] [_MyDstMode] + Cull Off + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + Pass //Main Light Shapes pass + { + Name "Main Pass" + Tags { "LightMode" = "Universal2D" } + + HLSLPROGRAM + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + + #if UNITY_VERSION >= 202230 + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl" + + #pragma multi_compile_instancing + #pragma multi_compile USE_SHAPE_LIGHT_TYPE_0 __ + #pragma multi_compile USE_SHAPE_LIGHT_TYPE_1 __ + #pragma multi_compile USE_SHAPE_LIGHT_TYPE_2 __ + #pragma multi_compile USE_SHAPE_LIGHT_TYPE_3 __ + + #if USE_SHAPE_LIGHT_TYPE_0 + SHAPE_LIGHT(0) + #endif + + #if USE_SHAPE_LIGHT_TYPE_1 + SHAPE_LIGHT(1) + #endif + + #if USE_SHAPE_LIGHT_TYPE_2 + SHAPE_LIGHT(2) + #endif + + #if USE_SHAPE_LIGHT_TYPE_3 + SHAPE_LIGHT(3) + #endif + + #pragma vertex CombinedShapeLightVertex + #pragma fragment CombinedShapeLightFragment + + + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Structs.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_CommonFunctions.hlsl" + #include_with_pragmas "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_ShaderFeatures.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Properties.hlsl" + + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/CombinedShapeLightShared.hlsl" + + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_VertexPass.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_FragmentPass.hlsl" + + + + + ENDHLSL + } + + Pass //Normal Mapping + { + Name "Normal Pass" + Tags { "LightMode" = "NormalsRendering" } + + HLSLPROGRAM + #pragma vertex NormalsRenderingVertex + #pragma fragment NormalsRenderingFragment + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #if UNITY_VERSION >= 202230 + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #endif + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl" + + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Structs.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_CommonFunctions.hlsl" + #include_with_pragmas "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_ShaderFeatures.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Properties.hlsl" + + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingVertexPass.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingFragmentPass.hlsl" + + ENDHLSL + } + } + + + SubShader + { + PackageRequirements + { + "com.unity.render-pipelines.universal" : "17.3" + } + + Tags {"Queue" = "Transparent" "RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline" "CanUseSpriteAtlas" = "True" "PreviewType" = "Plane" "RenderPipeline"="UniversalPipeline"} + Blend [_MySrcMode] [_MyDstMode] + Cull Off + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + Pass //Main Light Shapes pass + { + Name "Main Pass" + + Tags { "LightMode" = "Universal2D" } + + HLSLPROGRAM + #pragma vertex CombinedShapeLightVertex + #pragma fragment CombinedShapeLightFragment + + #pragma multi_compile_instancing + #pragma multi_compile USE_SHAPE_LIGHT_TYPE_0 __ + #pragma multi_compile USE_SHAPE_LIGHT_TYPE_1 __ + #pragma multi_compile USE_SHAPE_LIGHT_TYPE_2 __ + #pragma multi_compile USE_SHAPE_LIGHT_TYPE_3 __ + + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/CombinedShapeLightShared.hlsl" + + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Structs.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_CommonFunctions.hlsl" + #include_with_pragmas "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_ShaderFeatures.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Properties.hlsl" + + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_VertexPass.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_FragmentPass.hlsl" + + ENDHLSL + } + + Pass //Normal Mapping + { + Name "Normal Pass" + + Tags { "LightMode" = "NormalsRendering" } + + HLSLPROGRAM + #pragma vertex NormalsRenderingVertex + #pragma fragment NormalsRenderingFragment + + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl" + + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Structs.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_CommonFunctions.hlsl" + #include_with_pragmas "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_ShaderFeatures.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Properties.hlsl" + + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingVertexPass.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingFragmentPass.hlsl" + + ENDHLSL + } + + Pass //Universal Forward + { + Name "Universal Forward" + + Tags { "LightMode" = "UniversalForward" "Queue"="Transparent" "RenderType"="Transparent"} + + HLSLPROGRAM + #pragma vertex CombinedShapeLightVertex + #pragma fragment CombinedShapeLightFragment + + #pragma multi_compile_instancing + #pragma multi_compile USE_SHAPE_LIGHT_TYPE_0 __ + #pragma multi_compile USE_SHAPE_LIGHT_TYPE_1 __ + #pragma multi_compile USE_SHAPE_LIGHT_TYPE_2 __ + #pragma multi_compile USE_SHAPE_LIGHT_TYPE_3 __ + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/CombinedShapeLightShared.hlsl" + + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Structs.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_CommonFunctions.hlsl" + #include_with_pragmas "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_ShaderFeatures.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Properties.hlsl" + + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_VertexPass.hlsl" + #include "ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_FragmentPass.hlsl" + + ENDHLSL + } + } + + //FallBack "AllIn1SpriteShader/AllIn1SpriteShader" + CustomEditor "AllIn1SpriteShader.AllIn12DRendererMaterialInspector" +} \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1Urp2dRenderer.shader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1Urp2dRenderer.shader.meta new file mode 100644 index 00000000..87f4cc85 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1Urp2dRenderer.shader.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: 202ffec9202f22e478034613d6beb49c +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/AllIn1Urp2dRenderer.shader + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders.meta new file mode 100644 index 00000000..153166a7 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ab83761dc46d94e4e90385302b0cd179 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader new file mode 100644 index 00000000..69e1624f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader @@ -0,0 +1,1382 @@ +BEGIN_OPTIONS + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" } + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" + ShaderName "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +END_OPTIONS + +BEGIN_PROPERTIES + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 +END_PROPERTIES + + +BEGIN_DEFINES + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb +END_DEFINES + +BEGIN_CBUFFER + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + +END_CBUFFER + +BEGIN_PASS("Forward") + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] +END_PASS + +BEGIN_PASS("GBuffer") + Cull [_CullingOption] +END_PASS + +BEGIN_CODE + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void ModifyVertex(inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void SurfaceFunction(inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + +END_CODE \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader.meta new file mode 100644 index 00000000..95180fe9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader.meta @@ -0,0 +1,17 @@ +fileFormatVersion: 2 +guid: 906fe447de9ad3b4e8d21d6ba60deb8a +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: ed1b96e11e9064957833ce8c01da6f92, type: 3} +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader.surfshader + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt new file mode 100644 index 00000000..f28f30ff --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt @@ -0,0 +1,16487 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: HDRP2019 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + + [HideInInspector] _StencilRef("Vector1 ", Int) = 0 + [HideInInspector] _StencilWriteMask("Vector1 ", Int) = 3 + [HideInInspector] _StencilRefDepth("Vector1 ", Int) = 0 + [HideInInspector] _StencilWriteMaskDepth("Vector1 ", Int) = 32 + [HideInInspector] _StencilRefMV("Vector1 ", Int) = 128 + [HideInInspector] _StencilWriteMaskMV("Vector1 ", Int) = 128 + [HideInInspector] _StencilRefDistortionVec("Vector1 ", Int) = 64 + [HideInInspector] _StencilWriteMaskDistortionVec("Vector1 ", Int) = 64 + [HideInInspector] _StencilWriteMaskGBuffer("Vector1 ", Int) = 3 + [HideInInspector] _StencilRefGBuffer("Vector1 ", Int) = 2 + [HideInInspector] _ZTestGBuffer("Vector1 ", Int) = 4 + [HideInInspector] [ToggleUI] _RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector] [ToggleUI] _ReceivesSSR("Boolean", Float) = 1 + [HideInInspector] _SurfaceType("Vector1 ", Float) = 0 + [HideInInspector] [ToggleUI] _ZWrite("Boolean", Float) = 0 + [HideInInspector] _TransparentSortPriority("Vector1 ", Int) = 0 + [HideInInspector] _ZTestDepthEqualForOpaque("Vector1 ", Int) = 4 + [HideInInspector] [Enum(UnityEngine.Rendering.CompareFunction)] _ZTestTransparent("Vector1", Float) = 4 + [HideInInspector] [ToggleUI] _TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector] [ToggleUI] _AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector] [ToggleUI] _UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector] _BlendMode("Float", Float) = 0 + } + SubShader + { + Tags { "RenderPipeline"="HDRenderPipeline" "RenderPipeline" = "HDRenderPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + Comp Always + Pass Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + // #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADDITIVE _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + #pragma multi_compile _ DEBUG_DISPLAY + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #define REQUIRE_DEPTH_TEXTURE + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + void Frag(PackedVaryingsToPS packedInput, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + out float4 outDiffuseLighting : SV_Target1, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : SV_Target1 + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = int(_DebugViewMaterialArray[0]); + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = int(_DebugViewMaterialArray[index]); + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + float3 diffuseLighting; + float3 specularLighting; + + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + { + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + // Alias + diffuseLighting = lightLoopOutput.diffuseLighting; + specularLighting = lightLoopOutput.specularLighting; + } + #else + { + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, diffuseLighting, specularLighting); + } + #endif + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + VaryingsPassToPS inputPass = UnpackVaryingsPassToPS(packedInput.vpass); + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(inputPass.positionCS, inputPass.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + ZTest [_ZTestGBuffer] + + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + Comp Always + Pass Replace + } + Cull [_CullingOption] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + #define SHADERPASS SHADERPASS_GBUFFER + #pragma multi_compile _ DEBUG_DISPLAY + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile _ LIGHT_LAYERS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + void Frag( PackedVaryingsToPS packedInput, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + ZClip [_ZClip] + ZWrite On + ZTest LEqual + + ColorMask 0 + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + + void Frag( PackedVaryingsToPS packedInput + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + float4 Frag(PackedVaryingsToPS packedInput + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) : SV_Target + { + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + ColorMask 0 + + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENESELECTIONPASS + #pragma editor_sync_compilation + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + + void Frag( PackedVaryingsToPS packedInput + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + Comp Always + Pass Replace + } + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + // #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + void Frag( PackedVaryingsToPS packedInput + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + + + + + } + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt.meta new file mode 100644 index 00000000..9943eb69 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 399eb10a7a397d147aedd61cb363c5b0 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2019.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt new file mode 100644 index 00000000..eef2c77a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt @@ -0,0 +1,25121 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: HDRP2020 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #pragma multi_compile SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Cull [_CullingOption] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + Comp Always + Pass Replace + } + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt.meta new file mode 100644 index 00000000..78fe0222 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a647821724afdce49a1ba80aff36898d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2020.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt new file mode 100644 index 00000000..a5c5ed7d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt @@ -0,0 +1,24976 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: HDRP2021 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile_raytracing PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_raytracing _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH SHADOW_VERY_HIGH + #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Cull [_CullingOption] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ LIGHT_LAYERS + #pragma multi_compile_raytracing _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile_raytracing PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_raytracing _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + Comp Always + Pass Replace + } + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + outDecalBuffer.w = (GetMeshRenderingLightLayer() & 0x000000FF) / 255.0; + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt.meta new file mode 100644 index 00000000..d366abbc --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a5e970f81e60df04c8f073f570232b06 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2021.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt new file mode 100644 index 00000000..1c448bbb --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt @@ -0,0 +1,25805 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: HDRP2022 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile_raytracing PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_raytracing _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + #pragma multi_compile_fragment AREA_SHADOW_MEDIUM AREA_SHADOW_HIGH + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + ColorMask [_LightLayersMaskBuffer4] 4 + ColorMask [_LightLayersMaskBuffer5] 5 + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_LightLayersMaskBuffer4] 4 + ColorMask [_LightLayersMaskBuffer5] 5 + + Cull [_CullingOption] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma target 4.5 + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile _ LIGHT_LAYERS + //#pragma multi_compile_raytracing _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + AlphaToMask [_AlphaCutoffEnable] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : DEPTH_OFFSET_SEMANTIC + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = unity_SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + outDecalBuffer.w = (GetMeshRenderingLightLayer() & 0x000000FF) / 255.0; + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt.meta new file mode 100644 index 00000000..f576e7d6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 9e1b3d9455d4c4b41ae7fe2ce00204de +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2022.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt new file mode 100644 index 00000000..24de0754 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt @@ -0,0 +1,25856 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: HDRP2023 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + #pragma multi_compile_fragment AREA_SHADOW_MEDIUM AREA_SHADOW_HIGH + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Cull [_CullingOption] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma target 4.5 + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile_fragment _ RENDERING_LAYERS + //#pragma multi_compile_raytracing _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) + DecalPrepassData decalPrepassData; + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + #endif + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + AlphaToMask [_AlphaCutoffEnable] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : DEPTH_OFFSET_SEMANTIC + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = unity_SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) + DecalPrepassData decalPrepassData; + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + #endif + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) + DecalPrepassData decalPrepassData; + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + #endif + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + outDecalBuffer.w = (GetMeshRenderingLayerMask() & 0x000000FF) / 255.0; + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt.meta new file mode 100644 index 00000000..e39fe8bf --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: c397c4395866b3f43a53dfd559528372 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_HDRP2023.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt new file mode 100644 index 00000000..aa270ab1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt @@ -0,0 +1,17401 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: Standard +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + } + SubShader + { + Tags { "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + CGPROGRAM + // compile directives + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma multi_compile_fwdbase + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + // -------- variant for: + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + #define SHADER_PASS SHADERPASS_FORWARD + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + float4 lmap : TEXCOORD8; + #if UNITY_SHOULD_SAMPLE_SH + half3 sh : TEXCOORD9; // SH + #endif + #ifdef LIGHTMAP_ON + UNITY_LIGHTING_COORDS(10,11) + UNITY_FOG_COORDS(12) + #else + UNITY_FOG_COORDS(10) + UNITY_SHADOW_COORDS(11) + #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + // SH/ambient and vertex lights + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + // Approximated illumination from non-important point lights + #ifdef VERTEXLIGHT_ON + o.sh += Shade4PointLights ( + unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0, + unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb, + unity_4LightAtten0, o.worldPos, o.worldNormal); + #endif + o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); + #endif + #endif // !LIGHTMAP_ON + + UNITY_TRANSFER_LIGHTING(o,v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_TRANSFER_FOG_COMBINED_WITH_TSPACE(o,o.pos); // pass fog coordinates to pixel shader + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_TRANSFER_FOG_COMBINED_WITH_WORLD_POS(o,o.pos); // pass fog coordinates to pixel shader + #else + UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader + #endif + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + // compute lighting & shadowing factor + UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.Specular; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + fixed4 c = 0; + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + // Call GI (lightmaps/SH/reflections) lighting function + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = d.worldSpacePosition; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + gi.light.color *= mulColor; + giInput.light.color *= mulColor; + #endif + + #if _UNLIT + c.rgb = l.Albedo; + c.a = l.Alpha; + #elif _BDRF3 || _SIMPLELIT + LightingBlinnPhong_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); + #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + LightingStandardSpecular_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingStandardSpecular (o, d.worldSpaceViewDir, gi); + #else + LightingStandard_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingStandard (o, d.worldSpaceViewDir, gi); + #endif + + c.rgb += o.Emission; + + ChainFinalColorForward(l, d, c); + + #if !DISABLEFOG + UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog + #endif + + + return c; + } + + ENDCG + + } + + + + // ---- deferred shading pass: + Pass + { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Cull [_CullingOption] + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma exclude_renderers nomrt + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_prepassfinal + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + #ifndef DIRLIGHTMAP_OFF + float3 viewDir : TEXCOORD8; + #endif + float4 lmap : TEXCOORD9; + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + half3 sh : TEXCOORD10; // SH + #endif + #else + #ifdef DIRLIGHTMAP_OFF + float4 lmapFadePos : TEXCOORD11; + #endif + #endif + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + float3 viewDirForLight = UnityWorldSpaceViewDir(o.worldPos); + #ifndef DIRLIGHTMAP_OFF + float3 worldBinormal = cross(o.worldNormal, o.worldTangent.xyz); + o.viewDir.x = dot(viewDirForLight, o.worldTangent.xyz); + o.viewDir.y = dot(viewDirForLight, worldBinormal); + o.viewDir.z = dot(viewDirForLight, o.worldNormal); + #endif + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #else + o.lmap.zw = 0; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #ifdef DIRLIGHTMAP_OFF + o.lmapFadePos.xyz = (mul(GetObjectToWorldMatrix(), v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w; + o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); + #endif + #else + o.lmap.xy = 0; + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); + #endif + #endif + + return o; + } + + + + #ifdef LIGHTMAP_ON + float4 unity_LightmapFade; + #endif + fixed4 unity_Ambient; + + + + // fragment shader + void Frag (VertexToPixel IN, + out half4 outGBuffer0 : SV_Target0, + out half4 outGBuffer1 : SV_Target1, + out half4 outGBuffer2 : SV_Target2, + out half4 outEmission : SV_Target3 + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + , out half4 outShadowMask : SV_Target4 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.SpecularPower; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + + half atten = 1; + + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = 0; + gi.light.dir = half3(0,1,0); + // Call GI (lightmaps/SH/reflections) lighting function + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = d.worldSpacePosition; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + + + #if _BDRF3 || _SIMPLELIT + + LightingBlinnPhong_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + + outEmission = LightingBlinnPhong_Deferred(o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + LightingStandardSpecular_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + // call lighting function to output g-buffer + outEmission = LightingStandardSpecular_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #else + LightingStandard_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + // call lighting function to output g-buffer + outEmission = LightingStandard_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #endif + + #if defined(_OVERRIDE_SHADOWMASK) && defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + outShadowMask = mulColor; + #endif + + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); + #else + half4 outShadowMask = 0; + ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); + #endif + + + } + + + + + ENDCG + + } + + + + + // ---- forward rendering additive lights pass: + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardAdd" } + ZWrite Off Blend One One + + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma skip_variants INSTANCING_ON + #pragma multi_compile_fwdadd_fullshadows + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + + + #define _PASSFORWARD 1 + #define _PASSFORWARDADD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + UNITY_LIGHTING_COORDS(8,9) + UNITY_FOG_COORDS(10) + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD18; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + UNITY_TRANSFER_LIGHTING(o, v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader + UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.SpecularPower; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + + + UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) + half4 c = 0; + + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + gi.light.color *= atten; + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + gi.light.color *= mulColor; + #endif + + #if _USESPECULAR + c += LightingStandardSpecular (o, worldViewDir, gi); + #elif _BDRF3 || _SIMPLELIT + c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); + #else + c += LightingStandard (o, worldViewDir, gi); + #endif + + + ChainFinalColorForward(l, d, c); + + #if !DISABLEFOG + UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog + #endif + #if !_ALPHABLEND_ON + UNITY_OPAQUE_ALPHA(c.a); + #endif + + return c; + } + + ENDCG + + } + + + Pass { + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + ZWrite On ZTest LEqual + + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_shadowcaster + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + V2F_SHADOW_CASTER; // may declare TEXCOORD0 for the wonderfully named .vec + float3 worldPos : TEXCOORD1; + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + float4 texcoord0 : TEXCOORD4; + float4 texcoord1 : TEXCOORD5; + float4 texcoord2 : TEXCOORD6; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD7; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD8; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD16; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + // sets o.pos, so do screenpos after. + TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(IN.worldPos)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + SHADOW_CASTER_FRAGMENT(IN) + } + + + ENDCG + + } + + + // ---- meta information extraction pass: + Pass + { + Name "Meta" + Tags { "LightMode" = "Meta" } + Cull Off + + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma shader_feature EDITOR_VISUALIZATION + + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "UnityMetaPass.cginc" + + #define _PASSMETA 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + #ifdef EDITOR_VISUALIZATION + float2 vizUV : TEXCOORD8; + float4 lightCoord : TEXCOORD9; + #endif + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD17; + // #endif + + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + + o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #ifdef EDITOR_VISUALIZATION + o.vizUV = 0; + o.lightCoord = 0; + if (unity_VisualizationMode == EDITORVIZ_TEXTURE) + o.vizUV = UnityMetaVizUV(unity_EditorViz_UVIndex, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, unity_EditorViz_Texture_ST); + else if (unity_VisualizationMode == EDITORVIZ_SHOWLIGHTMASK) + { + o.vizUV = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + o.lightCoord = mul(unity_EditorViz_WorldToLight, mul(GetObjectToWorldMatrix(), float4(v.vertex.xyz, 1))); + } + #endif + + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + + ChainSurfaceFunction(l, d); + + UnityMetaInput metaIN; + UNITY_INITIALIZE_OUTPUT(UnityMetaInput, metaIN); + metaIN.Albedo = l.Albedo; + metaIN.Emission = l.Emission; + + #if _USESPECULAR + metaIN.SpecularColor = l.Specular; + #endif + + #ifdef EDITOR_VISUALIZATION + metaIN.VizUV = IN.vizUV; + metaIN.LightCoord = IN.lightCoord; + #endif + return UnityMetaFragment(metaIN); + } + ENDCG + + } + + + + + + } + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt.meta new file mode 100644 index 00000000..719a8bc4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 3d8afde0e2ea785468f09f3f58cf5803 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_Standard.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt new file mode 100644 index 00000000..c7736e8c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt @@ -0,0 +1,4828 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: URP2019 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + + // Keywords + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE + #pragma multi_compile _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS _ADDITIONAL_OFF + #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile _ _SHADOWS_SOFT + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + + // GraphKeywords: + + + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define SHADER_PASS SHADERPASS_FORWARD + #define SHADERPASS_FORWARD + + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if defined(_USESPECULAR) || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + InputData inputData; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + + #if !_UNLIT + #if _SIMPLELIT + half4 color = UniversalFragmentBlinnPhong( + inputData, + l.Albedo, + float4(specular * l.Smoothness, 0), + l.SpecularPower * 128, + l.Emission, + l.Alpha); + color.a = l.Alpha; + #elif _BAKEDLIT + half4 color = color = UniversalFragmentBakedLit(inputData, l.Albedo, l.Alpha, normalTS); + #else + half4 color = UniversalFragmentPBR( + inputData, + l.Albedo, + metallic, + specular, + l.Smoothness, + l.Occlusion, + l.Emission, + l.Alpha); + #endif + + #else + half4 color = half4(l.Albedo, l.Alpha); + #endif + + #if _UNLITFOG && !DISABLEFOG + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + + ChainFinalColorForward(l, d, color); + + return color; + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS_SHADOWCASTER + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt.meta new file mode 100644 index 00000000..435b58b6 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: b6a5f34c034fbd04db605bdcc50b16cd +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2019.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt new file mode 100644 index 00000000..69d89313 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt @@ -0,0 +1,4882 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: URP2020 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + // Keywords + #pragma multi_compile _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE + #pragma multi_compile _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS _ADDITIONAL_OFF + #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #endif + + #if !_UNLIT + #if _SIMPLELIT + half4 color = UniversalFragmentBlinnPhong( + inputData, + l.Albedo, + float4(specular * l.Smoothness, 0), + l.SpecularPower * 128, + l.Emission, + l.Alpha); + color.a = l.Alpha; + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, l.Albedo, l.Alpha, normalTS); + #else + + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + half4 color = UniversalFragmentPBR(inputData, surface); + + #endif + + #else + half4 color = half4(l.Albedo, l.Alpha); + + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + ChainFinalColorForward(l, d, color); + + return color; + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS_SHADOWCASTER + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt.meta new file mode 100644 index 00000000..ff8c4c09 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 5b690ab8311c671458478ca7f852b720 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2020.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt new file mode 100644 index 00000000..cbc61a3e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt @@ -0,0 +1,4974 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: URP2021 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _CLUSTERED_RENDERING + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + return color; + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt.meta new file mode 100644 index 00000000..43720489 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: cf43ea038b1b8bc40bb9018effdc2e94 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2021.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt new file mode 100644 index 00000000..fc0347b8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt @@ -0,0 +1,5001 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: URP2022 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outColor : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + outColor = color; + + #ifdef _WRITE_RENDERING_LAYERS + #if UNITY_VERSION >= 60020000 + outRenderingLayers = EncodeMeshRenderingLayer(); + #else + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + #endif + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt.meta new file mode 100644 index 00000000..13063a1e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: ce8330b40cde2f94c9cb20367e34bd3a +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2022.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt new file mode 100644 index 00000000..cbf66e1f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt @@ -0,0 +1,5252 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: URP2023 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLitTransparent_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Transparent" "Queue" = "Transparent" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW + #pragma multi_compile_fragment _ _SHADOWS_SOFT_MEDIUM + #pragma multi_compile_fragment _ _SHADOWS_SOFT_HIGH + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _ EVALUATE_SH_VERTEX + #pragma multi_compile _ EVALUATE_SH_MIXED + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outColor : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #elif defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2) + #if UNITY_VERSION >= 60000009 + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos, IN.probeOcclusion, inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos); + #endif + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + outColor = color; + + #ifdef _WRITE_RENDERING_LAYERS + #if UNITY_VERSION >= 60020000 + outRenderingLayers = EncodeMeshRenderingLayer(); + #else + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + #endif + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + + } + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt.meta new file mode 100644 index 00000000..e37c59df --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: b3fd67a7feee2e848b1efa22e4d324c0 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLitTransparent_BetterShader_URP2023.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader new file mode 100644 index 00000000..3129cd43 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader @@ -0,0 +1,1384 @@ +BEGIN_OPTIONS + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" + ShaderName "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +END_OPTIONS + +BEGIN_PROPERTIES + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 +END_PROPERTIES + + +BEGIN_DEFINES + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + +END_DEFINES + +BEGIN_CBUFFER + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + +END_CBUFFER + +BEGIN_PASS("Forward") + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] +END_PASS + +BEGIN_PASS("GBuffer") + Cull [_CullingOption] +END_PASS + +BEGIN_CODE + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void ModifyVertex(inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void SurfaceFunction(inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + +END_CODE \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader.meta new file mode 100644 index 00000000..b411afd2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader.meta @@ -0,0 +1,17 @@ +fileFormatVersion: 2 +guid: 325f1e8448719734a8a423b1dec4f03a +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: ed1b96e11e9064957833ce8c01da6f92, type: 3} +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader.surfshader + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt new file mode 100644 index 00000000..50e6685a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt @@ -0,0 +1,16505 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: HDRP2019 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + + [HideInInspector] _StencilRef("Vector1 ", Int) = 0 + [HideInInspector] _StencilWriteMask("Vector1 ", Int) = 3 + [HideInInspector] _StencilRefDepth("Vector1 ", Int) = 0 + [HideInInspector] _StencilWriteMaskDepth("Vector1 ", Int) = 32 + [HideInInspector] _StencilRefMV("Vector1 ", Int) = 128 + [HideInInspector] _StencilWriteMaskMV("Vector1 ", Int) = 128 + [HideInInspector] _StencilRefDistortionVec("Vector1 ", Int) = 64 + [HideInInspector] _StencilWriteMaskDistortionVec("Vector1 ", Int) = 64 + [HideInInspector] _StencilWriteMaskGBuffer("Vector1 ", Int) = 3 + [HideInInspector] _StencilRefGBuffer("Vector1 ", Int) = 2 + [HideInInspector] _ZTestGBuffer("Vector1 ", Int) = 4 + [HideInInspector] [ToggleUI] _RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector] [ToggleUI] _ReceivesSSR("Boolean", Float) = 1 + [HideInInspector] _SurfaceType("Vector1 ", Float) = 0 + [HideInInspector] [ToggleUI] _ZWrite("Boolean", Float) = 0 + [HideInInspector] _TransparentSortPriority("Vector1 ", Int) = 0 + [HideInInspector] _ZTestDepthEqualForOpaque("Vector1 ", Int) = 4 + [HideInInspector] [Enum(UnityEngine.Rendering.CompareFunction)] _ZTestTransparent("Vector1", Float) = 4 + [HideInInspector] [ToggleUI] _TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector] [ToggleUI] _AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector] [ToggleUI] _UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector] _BlendMode("Float", Float) = 0 + } + SubShader + { + Tags { "RenderPipeline"="HDRenderPipeline" "RenderPipeline" = "HDRenderPipeline" "RenderType" = "HDLitShader" "Queue" = "Geometry+225" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + Comp Always + Pass Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + // #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADDITIVE _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + #pragma multi_compile _ DEBUG_DISPLAY + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #define REQUIRE_DEPTH_TEXTURE + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + void Frag(PackedVaryingsToPS packedInput, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + out float4 outDiffuseLighting : SV_Target1, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : SV_Target1 + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = int(_DebugViewMaterialArray[0]); + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = int(_DebugViewMaterialArray[index]); + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + float3 diffuseLighting; + float3 specularLighting; + + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + { + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + // Alias + diffuseLighting = lightLoopOutput.diffuseLighting; + specularLighting = lightLoopOutput.specularLighting; + } + #else + { + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, diffuseLighting, specularLighting); + } + #endif + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + VaryingsPassToPS inputPass = UnpackVaryingsPassToPS(packedInput.vpass); + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(inputPass.positionCS, inputPass.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + ZTest [_ZTestGBuffer] + + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + Comp Always + Pass Replace + } + Cull [_CullingOption] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + #define SHADERPASS SHADERPASS_GBUFFER + #pragma multi_compile _ DEBUG_DISPLAY + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile _ LIGHT_LAYERS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + void Frag( PackedVaryingsToPS packedInput, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + ZClip [_ZClip] + ZWrite On + ZTest LEqual + + ColorMask 0 + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + + void Frag( PackedVaryingsToPS packedInput + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + float4 Frag(PackedVaryingsToPS packedInput + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) : SV_Target + { + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + ColorMask 0 + + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENESELECTIONPASS + #pragma editor_sync_compilation + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + + void Frag( PackedVaryingsToPS packedInput + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + Comp Always + Pass Replace + } + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + // #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _ _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + + // define FragInputs structure + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" + #endif + + + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #ifdef DEBUG_DISPLAY + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + + #if (SHADERPASS == SHADERPASS_FORWARD) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + + #define HAS_LIGHTLOOP + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #endif + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + // Used by SceneSelectionPass + int _ObjectId; + int _PassValue; + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + CBUFFER_START(UnityPerMaterial) + float _StencilRef; + float _StencilWriteMask; + float _StencilRefDepth; + float _StencilWriteMaskDepth; + float _StencilRefMV; + float _StencilWriteMaskMV; + float _StencilRefDistortionVec; + float _StencilWriteMaskDistortionVec; + float _StencilWriteMaskGBuffer; + float _StencilRefGBuffer; + float _ZTestGBuffer; + float _RequireSplitLighting; + float _ReceivesSSR; + float _ZWrite; + float _TransparentSortPriority; + float _ZTestDepthEqualForOpaque; + float _ZTestTransparent; + float _TransparentBackfaceEnable; + float _AlphaCutoffEnable; + float _UseShadowThreshold; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +struct VaryingsToPS +{ + VertexToPixel vmesh; + #ifdef VARYINGS_NEED_PASS + VaryingsPassToPS vpass; + #endif +}; + +struct PackedVaryingsToPS +{ + #ifdef VARYINGS_NEED_PASS + PackedVaryingsPassToPS vpass; + #endif + VertexToPixel vmesh; + + UNITY_VERTEX_OUTPUT_STEREO +}; + +PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input) +{ + PackedVaryingsToPS output = (PackedVaryingsToPS)0; + output.vmesh = input.vmesh; + #ifdef VARYINGS_NEED_PASS + output.vpass = PackVaryingsPassToPS(input.vpass); + #endif + + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + return output; +} + + + + +VertexToPixel VertMesh(VertexData input) +{ + VertexToPixel output = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + + + ChainModifyVertex(input, output, _Time); + + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + return output; +} + + +#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) +void MeshDecalsPositionZBias(inout VaryingsToPS input) +{ +#if defined(UNITY_REVERSED_Z) + input.vmesh.pos.z -= _DecalMeshDepthBias; +#else + input.vmesh.pos.z += _DecalMeshDepthBias; +#endif +} +#endif + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + +// This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency +float unity_OneOverOutputBoost; +float unity_MaxOutputValue; + +CBUFFER_START(UnityMetaPass) +// x = use uv1 as raster position +// y = use uv2 as raster position +bool4 unity_MetaVertexControl; + +// x = return albedo +// y = return normal +bool4 unity_MetaFragmentControl; +CBUFFER_END + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS output = (VaryingsToPS)0; + output.vmesh = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output.vmesh); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.vmesh.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + +#ifdef VARYINGS_NEED_POSITION_WS + output.vmesh.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz); +#endif + +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + // Normal is required for triplanar mapping + output.vmesh.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.vmesh.worldTangent = float4(1.0, 0.0, 0.0, 0.0); +#endif + + output.vmesh.texcoord0 = inputMesh.texcoord0; + output.vmesh.texcoord1 = inputMesh.texcoord1; + output.vmesh.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.vmesh.texcoord3 = inputMesh.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vmesh.vertexColor = inputMesh.vertexColor; + // #endif + + return PackVaryingsToPS(output); +} +#else + +PackedVaryingsToPS Vert(VertexData inputMesh) +{ + VaryingsToPS varyingsType; + varyingsType.vmesh = VertMesh(inputMesh); + #if (SHADERPASS == SHADERPASS_DBUFFER_MESH) + MeshDecalsPositionZBias(varyingsType); + #endif + return PackVaryingsToPS(varyingsType); +} + +#endif + + + + + + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + #ifdef _HAS_REFRACTION + if (_EnableSSRefraction) + { + // surfaceData.ior = surfaceDescription.RefractionIndex; + // surfaceData.transmittanceColor = surfaceDescription.RefractionColor; + // surfaceData.atDistance = surfaceDescription.RefractionDistance; + + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + // surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + // tangent-space normal + float3 normalTS = float3(0.0f, 0.0f, 1.0f); + normalTS = surfaceDescription.Normal; + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(normalTS, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = normalTS; + #endif + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + // surfaceData.tangentWS = TransformTangentToWorld(surfaceDescription.Tangent, fragInputs.tangentToWorld); + + #if HAVE_DECALS + if (_EnableDecals) + { + #if VERSION_GREATER_EQUAL(10,2) + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceData.geomNormalWS, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData.geomNormalWS, surfaceData); + #else + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, surfaceDescription.Alpha); + ApplyDecalToSurfaceData(decalSurfaceData, surfaceData); + #endif + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #ifdef _ENABLE_GEOMETRIC_SPECULAR_AA + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // uint3 fadeMaskSeed = asuint((int3)(V * _ScreenSize.xyx)); // Quantize V to _ScreenSize values + // LODDitheringTransition(fadeMaskSeed, unity_LODFade.x); + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = posInput.deviceDepth; + #endif + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceDescription.Distortion; + //builtinData.distortionBlur = surfaceDescription.DistortionBlur; + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #else + builtinData.distortion = float2(0.0, 0.0); + builtinData.distortionBlur = 0.0; + #endif + + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + } + + + void Frag( PackedVaryingsToPS packedInput + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput); + FragInputs input = BuildFragInputs(packedInput.vmesh); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(packedInput.vmesh, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = packedInput.vmesh.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + + + + + } + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt.meta new file mode 100644 index 00000000..deee84d3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: e25ae0d994e4df1408dc1cbf96a8adf3 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2019.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt new file mode 100644 index 00000000..9965de86 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt @@ -0,0 +1,25148 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: HDRP2020 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "HDLitShader" "Queue" = "Geometry+225" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #pragma multi_compile SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Cull [_CullingOption] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + Comp Always + Pass Replace + } + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" // Need to be here for Gradient struct definition + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex); + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // copy before user modification, since we'll apply that to the copy later + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || (_PASSFORWARD && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + #if defined(_ENABLE_SHADOW_MATTE) && SHADERPASS == SHADERPASS_FORWARD_UNLIT + HDShadowContext shadowContext = InitShadowContext(); + float shadow; + float3 shadow3; + // We need to recompute some coordinate not computed by default for shadow matte + posInput = GetPositionInput(fragInputs.positionSS.xy, _ScreenSize.zw, fragInputs.positionSS.z, UNITY_MATRIX_I_VP, GetWorldToViewMatrix()); + float3 upWS = normalize(fragInputs.tangentToWorld[1]); + uint renderingLayers = GetMeshRenderingLightLayer(); + ShadowLoopMin(shadowContext, posInput, upWS, asuint(_ShadowMatteFilter), renderingLayers, shadow3); + shadow = dot(shadow3, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); + + float4 shadowColor = (1.0 - shadow) * surfaceDescription.ShadowTint.rgba; + float localAlpha = saturate(shadowColor.a + surfaceDescription.Alpha); + + // Keep the nested lerp + // With no Color (bsdfData.color.rgb, bsdfData.color.a == 0.0f), just use ShadowColor*Color to avoid a ring of "white" around the shadow + // And mix color to consider the Color & ShadowColor alpha (from texture or/and color picker) + #ifdef _SURFACE_TYPE_TRANSPARENT + surfaceData.baseColor = lerp(shadowColor.rgb * surfaceData.baseColor, lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow), surfaceDescription.Alpha); + #else + surfaceData.baseColor = lerp(lerp(shadowColor.rgb, surfaceData.baseColor, 1.0 - surfaceDescription.ShadowTint.a), surfaceData.baseColor, shadow); + #endif + localAlpha = ApplyBlendMode(surfaceData.baseColor, localAlpha).a; + + surfaceDescription.Alpha = localAlpha; + #endif + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + //builtinData.distortion = surfaceData.Distortion; + //builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt.meta new file mode 100644 index 00000000..dd2bcb1e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: b8403357ed2de81489de24747f4c4e40 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2020.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt new file mode 100644 index 00000000..acefdd5f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt @@ -0,0 +1,25003 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: HDRP2021 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "HDLitShader" "Queue" = "Geometry+225" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile_raytracing PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_raytracing _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH SHADOW_VERY_HIGH + #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Cull [_CullingOption] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ LIGHT_LAYERS + #pragma multi_compile_raytracing _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile_raytracing PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_raytracing _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + Comp Always + Pass Replace + } + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define RAYTRACING_SHADER_GRAPH_HIGH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + outDecalBuffer.w = (GetMeshRenderingLightLayer() & 0x000000FF) / 255.0; + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB +#if UNITY_VERSION >= UNITY_2021_3_31 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + + + // compute world space normal + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs.tangentToWorld[2], alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + //posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, fragInputs.texCoord1, fragInputs.texCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #if defined(UNITY_VIRTUAL_TEXTURING) + builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt.meta new file mode 100644 index 00000000..5310840c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 5545a9e4fbadc354c82bb73fb11b0af7 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2021.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt new file mode 100644 index 00000000..5b8610ec --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt @@ -0,0 +1,25832 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: HDRP2022 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "HDLitShader" "Queue" = "Geometry+225" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile_raytracing PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_raytracing _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + #pragma multi_compile_fragment AREA_SHADOW_MEDIUM AREA_SHADOW_HIGH + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + ColorMask [_LightLayersMaskBuffer4] 4 + ColorMask [_LightLayersMaskBuffer5] 5 + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_LightLayersMaskBuffer4] 4 + ColorMask [_LightLayersMaskBuffer5] 5 + + Cull [_CullingOption] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma target 4.5 + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile _ LIGHT_LAYERS + //#pragma multi_compile_raytracing _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + AlphaToMask [_AlphaCutoffEnable] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : DEPTH_OFFSET_SEMANTIC + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = unity_SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + DecalPrepassData decalPrepassData; + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.decalLayerMask = GetMeshRenderingDecalLayer(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + outDecalBuffer.w = (GetMeshRenderingLightLayer() & 0x000000FF) / 255.0; + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl" + +#if UNITY_VERSION >= 202239 + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition +#else + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphHeader.hlsl" +#endif + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt.meta new file mode 100644 index 00000000..a02118e1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: f92b26827dd1dcc45b0edccd67279b1d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2022.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt new file mode 100644 index 00000000..85bcd12d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt @@ -0,0 +1,25883 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: HDRP2023 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + + [HideInInspector]_RenderQueueType("Float", Float) = 1 + [HideInInspector][ToggleUI]_AddPrecomputedVelocity("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_DepthOffsetEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentWritingMotionVec("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaCutoffEnable("Boolean", Float) = 0 + [HideInInspector]_TransparentSortPriority("_TransparentSortPriority", Float) = 0 + [HideInInspector][ToggleUI]_UseShadowThreshold("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPrepassEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_TransparentDepthPostpassEnable("Boolean", Float) = 0 + [HideInInspector]_SurfaceType("Float", Float) = 0 + [HideInInspector]_BlendMode("Float", Float) = 0 + [HideInInspector]_SrcBlend("Float", Float) = 1 + [HideInInspector]_DstBlend("Float", Float) = 0 + [HideInInspector]_AlphaSrcBlend("Float", Float) = 1 + [HideInInspector]_AlphaDstBlend("Float", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMask("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_AlphaToMaskInspectorValue("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ZWrite("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_TransparentZWrite("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableFogOnTransparent("Boolean", Float) = 1 + [HideInInspector]_ZTestDepthEqualForOpaque("Float", Int) = 4 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)]_ZTestTransparent("Float", Float) = 4 + [HideInInspector][ToggleUI]_TransparentBackfaceEnable("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_RequireSplitLighting("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_ReceivesSSR("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_ReceivesSSRTransparent("Boolean", Float) = 0 + [HideInInspector][ToggleUI]_EnableBlendModePreserveSpecularLighting("Boolean", Float) = 1 + [HideInInspector][ToggleUI]_SupportDecals("Boolean", Float) = 1 + [HideInInspector]_StencilRef("Float", Int) = 0 + [HideInInspector]_StencilWriteMask("Float", Int) = 6 + [HideInInspector]_StencilRefDepth("Float", Int) = 8 + [HideInInspector]_StencilWriteMaskDepth("Float", Int) = 8 + [HideInInspector]_StencilRefMV("Float", Int) = 40 + [HideInInspector]_StencilWriteMaskMV("Float", Int) = 40 + [HideInInspector]_StencilRefDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskDistortionVec("Float", Int) = 4 + [HideInInspector]_StencilWriteMaskGBuffer("Float", Int) = 14 + [HideInInspector]_StencilRefGBuffer("Float", Int) = 10 + [HideInInspector]_ZTestGBuffer("Float", Int) = 4 + [HideInInspector][ToggleUI]_RayTracing("Boolean", Float) = 0 + [HideInInspector][Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Float", Float) = 0 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline" = "HDRenderPipeline" "RenderType" = "HDLitShader" "Queue" = "Geometry+225" } + + + Pass + { + // based on HDLitPass.template + Name "Forward" + Tags { "LightMode" = "Forward" } + + + + Stencil + { + WriteMask [_StencilWriteMask] + Ref [_StencilRef] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + ColorMask [_ColorMaskTransparentVel] 1 + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH + #pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON + #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST + #pragma multi_compile_fragment AREA_SHADOW_MEDIUM AREA_SHADOW_HIGH + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + + + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_FORWARD + #define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING + #define HAS_LIGHTLOOP + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #ifdef UNITY_VIRTUAL_TEXTURING + #define VT_BUFFER_TARGET SV_Target1 + #define EXTRA_BUFFER_TARGET SV_Target2 + #else + #define EXTRA_BUFFER_TARGET SV_Target1 + #endif + + + + + void Frag(VertexToPixel v2p, + #ifdef OUTPUT_SPLIT_LIGHTING + out float4 outColor : SV_Target0, // outSpecularLighting + #ifdef UNITY_VIRTUAL_TEXTURING + out float4 outVTFeedback : VT_BUFFER_TARGET, + #endif + out float4 outDiffuseLighting : EXTRA_BUFFER_TARGET, + OUTPUT_SSSBUFFER(outSSSBuffer) + #else + out float4 outColor : SV_Target0 + #ifdef UNITY_VIRTUAL_TEXTURING + ,out float4 outVTFeedback : VT_BUFFER_TARGET + #endif + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + , out float4 outMotionVec : EXTRA_BUFFER_TARGET + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + #endif // OUTPUT_SPLIT_LIGHTING + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + // Init outMotionVector here to solve compiler warning (potentially unitialized variable) + // It is init to the value of forceNoMotion (with 2.0) + outMotionVec = float4(2.0, 0.0, 0.0, 0.0); + #endif + + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer. + input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy; + + uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + + PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); + + outColor = float4(0.0, 0.0, 0.0, 0.0); + + // We need to skip lighting when doing debug pass because the debug pass is done before lighting so some buffers may not be properly initialized potentially causing crashes on PS4. + + #ifdef DEBUG_DISPLAY + // Init in debug display mode to quiet warning + #ifdef OUTPUT_SPLIT_LIGHTING + outDiffuseLighting = 0; + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #endif + + + + // Same code in ShaderPassForwardUnlit.shader + // Reminder: _DebugViewMaterialArray[i] + // i==0 -> the size used in the buffer + // i>0 -> the index used (0 value means nothing) + // The index stored in this buffer could either be + // - a gBufferIndex (always stored in _DebugViewMaterialArray[1] as only one supported) + // - a property index which is different for each kind of material even if reflecting the same thing (see MaterialSharedProperty) + bool viewMaterial = false; + int bufferSize = _DebugViewMaterialArray[0].x; + if (bufferSize != 0) + { + bool needLinearToSRGB = false; + float3 result = float3(1.0, 0.0, 1.0); + + // Loop through the whole buffer + // Works because GetSurfaceDataDebug will do nothing if the index is not a known one + for (int index = 1; index <= bufferSize; index++) + { + int indexMaterialProperty = _DebugViewMaterialArray[index].x; + + // skip if not really in use + if (indexMaterialProperty != 0) + { + viewMaterial = true; + + GetPropertiesDataDebug(indexMaterialProperty, result, needLinearToSRGB); + GetVaryingsDataDebug(indexMaterialProperty, input, result, needLinearToSRGB); + GetBuiltinDataDebug(indexMaterialProperty, builtinData, posInput, result, needLinearToSRGB); + GetSurfaceDataDebug(indexMaterialProperty, surfaceData, result, needLinearToSRGB); + GetBSDFDataDebug(indexMaterialProperty, bsdfData, result, needLinearToSRGB); + } + } + + // TEMP! + // For now, the final blit in the backbuffer performs an sRGB write + // So in the meantime we apply the inverse transform to linear data to compensate. + if (!needLinearToSRGB) + result = SRGBToLinear(max(0, result)); + + outColor = float4(result, 1.0); + } + + if (!viewMaterial) + { + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_DIFFUSE_COLOR || _DebugFullScreenMode == FULLSCREENDEBUGMODE_VALIDATE_SPECULAR_COLOR) + { + float3 result = float3(0.0, 0.0, 0.0); + + GetPBRValidatorDebug(surfaceData, result); + + outColor = float4(result, 1.0f); + } + else if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_TRANSPARENCY_OVERDRAW) + { + float4 result = _DebugTransparencyOverdrawWeight * float4(TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_COST, TRANSPARENCY_OVERDRAW_A); + outColor = result; + } + else + #endif + { + #ifdef _SURFACE_TYPE_TRANSPARENT + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT; + #else + uint featureFlags = LIGHT_FEATURE_MASK_FLAGS_OPAQUE; + #endif + + LightLoopOutput lightLoopOutput; + LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, lightLoopOutput); + + float3 diffuseLighting = lightLoopOutput.diffuseLighting; + float3 specularLighting = lightLoopOutput.specularLighting; + + diffuseLighting *= GetCurrentExposureMultiplier(); + specularLighting *= GetCurrentExposureMultiplier(); + + #ifdef OUTPUT_SPLIT_LIGHTING + if (_EnableSubsurfaceScattering != 0 && ShouldOutputSplitLighting(bsdfData)) + { + outColor = float4(specularLighting, 1.0); + outDiffuseLighting = float4(TagLightingForSSS(diffuseLighting), 1.0); + } + else + { + outColor = float4(diffuseLighting + specularLighting, 1.0); + outDiffuseLighting = 0; + } + ENCODE_INTO_SSSBUFFER(surfaceData, posInput.positionSS, outSSSBuffer); + #else + outColor = ApplyBlendMode(diffuseLighting, specularLighting, builtinData.opacity); + outColor = EvaluateAtmosphericScattering(posInput, V, outColor); + #endif + + ChainFinalColorForward(l, d, outColor); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + bool forceNoMotion = any(unity_MotionVectorsParams.yw == 0.0); + // outMotionVec is already initialize at the value of forceNoMotion (see above) + if (!forceNoMotion) + { + float2 motionVec = CalculateMotionVector(v2p.motionVectorCS, v2p.previousPositionCS); + EncodeMotionVector(motionVec * 0.5, outMotionVec); + outMotionVec.zw = 1.0; + } + #endif + } + + #ifdef DEBUG_DISPLAY + } + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + outVTFeedback = builtinData.vtPackedFeedback; + #endif + } + + ENDHLSL + } + Pass + { + // based on HDLitPass.template + Name "GBuffer" + Tags { "LightMode" = "GBuffer" } + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZTest [_ZTestGBuffer] + Stencil + { + WriteMask [_StencilWriteMaskGBuffer] + Ref [_StencilRefGBuffer] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + Cull [_CullingOption] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma target 4.5 + + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ LOD_FADE_CROSSFADE + #pragma multi_compile_fragment _ RENDERING_LAYERS + //#pragma multi_compile_raytracing _ LIGHT_LAYERS + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ DEBUG_DISPLAY + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile_fragment PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile_fragment _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT + #pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT + #pragma multi_compile _ USE_LEGACY_LIGHTMAPS + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_GBUFFER + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + void Frag( VertexToPixel v2f, + OUTPUT_GBUFFER(outGBuffer) + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + ENCODE_INTO_GBUFFER(surfaceData, builtinData, posInput.positionSS, outGBuffer); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + } + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + + + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + ZWrite On + ColorMask 0 + ZClip [_ZClip] + + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + //#pragma multi_compile_local _ _ALPHATEST_ON + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_SHADOWS + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + //------------------------------------------------------------------------------------- + // Defines + //------------------------------------------------------------------------------------- + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + #endif + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) + DecalPrepassData decalPrepassData; + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + #endif + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + + + } + + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "DepthOnly" + Tags { "LightMode" = "DepthOnly" } + + //------------------------------------------------------------------------------------- + // Render Modes (Blend, Cull, ZTest, Stencil, etc) + //------------------------------------------------------------------------------------- + + Cull Back + + + ZWrite On + + + // Stencil setup + Stencil + { + WriteMask [_StencilWriteMaskDepth] + Ref [_StencilRefDepth] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + AlphaToMask [_AlphaCutoffEnable] + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + //#pragma enable_d3d11_debug_symbols + + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #pragma multi_compile _ WRITE_NORMAL_BUFFER + #pragma multi_compile _ WRITE_MSAA_DEPTH + #define _PASSDEPTH 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + #if defined(WRITE_NORMAL_BUFFER) && defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target2 + #elif defined(WRITE_NORMAL_BUFFER) || defined(WRITE_MSAA_DEPTH) + #define SV_TARGET_DECAL SV_Target1 + #else + #define SV_TARGET_DECAL SV_Target0 + #endif + + + void Frag( VertexToPixel v2p + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + + #if defined(_DEPTHOFFSET_ON) && !defined(SCENEPICKINGPASS) + , out float outputDepth : DEPTH_OFFSET_SEMANTIC + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2p); + FragInputs input = BuildFragInputs(v2p); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2p, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // to prevent stripping + surfaceData.normalWS *= saturate(l.Albedo.r + 9999); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = unity_SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) + DecalPrepassData decalPrepassData; + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + #endif + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + } + + + + ENDHLSL + } + + + + Pass + { + // based on HDLitPass.template + Name "META" + Tags { "LightMode" = "META" } + + Cull Off + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma multi_compile_instancing + + //#pragma multi_compile_local _ _ALPHATEST_ON + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT + #define RAYTRACING_SHADER_GRAPH_HIGH + #define REQUIRE_DEPTH_TEXTURE + #define _PASSMETA 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + float4 Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + // no debug apply during light transport pass + + BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData); + LightTransportData lightTransportData = GetLightTransportData(surfaceData, builtinData, bsdfData); + + // This shader is call two times. Once for getting emissiveColor, the other time to get diffuseColor + // We use unity_MetaFragmentControl to make the distinction. + float4 res = float4(0.0, 0.0, 0.0, 1.0); + + if (unity_MetaFragmentControl.x) + { + // Apply diffuseColor Boost from LightmapSettings. + // put abs here to silent a warning, no cost, no impact as color is assume to be positive. + res.rgb = clamp(pow(abs(lightTransportData.diffuseColor), saturate(unity_OneOverOutputBoost)), 0, unity_MaxOutputValue); + } + + if (unity_MetaFragmentControl.y) + { + // emissive use HDR format + res.rgb = lightTransportData.emissiveColor; + } + + return res; + } + + + + ENDHLSL + } + + Pass + { + // based on HDLitPass.template + Name "SceneSelectionPass" + Tags { "LightMode" = "SceneSelectionPass" } + + Cull Off + ColorMask 0 + + + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + //------------------------------------------------------------------------------------- + // Variant Definitions (active field translations to HDRP defines) + //------------------------------------------------------------------------------------- + // #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1 + // #define _MATERIAL_FEATURE_TRANSMISSION 1 + // #define _MATERIAL_FEATURE_ANISOTROPY 1 + // #define _MATERIAL_FEATURE_IRIDESCENCE 1 + // #define _MATERIAL_FEATURE_SPECULAR_COLOR 1 + #define _ENABLE_FOG_ON_TRANSPARENT 1 + // #define _AMBIENT_OCCLUSION 1 + // #define _SPECULAR_OCCLUSION_FROM_AO 1 + // #define _SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL 1 + // #define _SPECULAR_OCCLUSION_CUSTOM 1 + // #define _ENERGY_CONSERVING_SPECULAR 1 + // #define _ENABLE_GEOMETRIC_SPECULAR_AA 1 + // #define _HAS_REFRACTION 1 + // #define _REFRACTION_PLANE 1 + // #define _REFRACTION_SPHERE 1 + // #define _DISABLE_DECALS 1 + // #define _DISABLE_SSR 1 + // #define _ADD_PRECOMPUTED_VELOCITY + // #define _WRITE_TRANSPARENT_MOTION_VECTOR 1 + // #define _DEPTHOFFSET_ON 1 + // #define _BLENDMODE_PRESERVE_SPECULAR_LIGHTING 1 + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define SCENESELECTIONPASS + #define _PASSSCENESELECT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + + + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + + void Frag( VertexToPixel IN + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #ifdef WRITE_MSAA_DEPTH + , out float1 depthColor : SV_Target1 + #endif + #elif defined(WRITE_MSAA_DEPTH) // When only WRITE_MSAA_DEPTH is define and not WRITE_NORMAL_BUFFER it mean we are Unlit and only need depth, but we still have normal buffer binded + , out float4 outNormalBuffer : SV_Target0 + , out float1 depthColor : SV_Target1 + #elif defined(SCENESELECTIONPASS) + , out float4 outColor : SV_Target0 + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + FragInputs input = BuildFragInputs(IN); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(IN, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), posInput.positionSS, outNormalBuffer); + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #endif + #elif defined(WRITE_MSAA_DEPTH) // When we are MSAA depth only without normal buffer + // Due to the binding order of these two render targets, we need to have them both declared + outNormalBuffer = float4(0.0, 0.0, 0.0, 1.0); + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + #elif defined(SCENESELECTIONPASS) + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #endif + } + + ENDHLSL + } + + + Pass + { + Name "ScenePickingPass" + Tags + { + "LightMode" = "Picking" + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma editor_sync_compilation + #pragma instancing_options renderinglayer + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ WRITE_DECAL_BUFFER + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #define SHADERPASS SHADERPASS_DEPTH_ONLY + #define SCENEPICKINGPASS + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + void Frag( VertexToPixel v2f + #if defined(SCENESELECTIONPASS) || defined(SCENEPICKINGPASS) + , out float4 outColor : SV_Target0 + #else + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target1 + #endif + #else + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_Target0 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + , out float4 outDecalBuffer : SV_TARGET_DECAL + #endif + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + // input.positionSS is SV_Position + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + + + #ifdef SCENESELECTIONPASS + // We use depth prepass for scene selection in the editor, this code allow to output the outline correctly + outColor = float4(_ObjectId, _PassValue, 1.0, 1.0); + #elif defined(SCENEPICKINGPASS) + outColor = _SelectionID; + #else + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2p.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif // alphatomask + #endif // msaa_depth + + + #if defined(WRITE_NORMAL_BUFFER) + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if (defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS)) || defined(WRITE_RENDERING_LAYER) + DecalPrepassData decalPrepassData; + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + #endif + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + #endif + #endif + + + } + + ENDHLSL + } + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZWrite On + Stencil + { + WriteMask [_StencilWriteMaskMV] + Ref [_StencilRefMV] + CompFront Always + PassFront Replace + CompBack Always + PassBack Replace + } + + + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + #pragma instancing_options renderinglayer + #pragma multi_compile _ LOD_FADE_CROSSFADE + + #pragma multi_compile _ WRITE_MSAA_DEPTH + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + #pragma multi_compile _ WRITE_NORMAL_BUFFER + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + #pragma multi_compile _ WRITE_DECAL_BUFFER + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + + + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDecalData.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#if defined(WRITE_DECAL_BUFFER) && defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target3 +#elif defined(WRITE_DECAL_BUFFER) || defined(WRITE_MSAA_DEPTH) +#define SV_TARGET_NORMAL SV_Target2 +#else +#define SV_TARGET_NORMAL SV_Target1 +#endif + +// Caution: Motion vector pass is different from Depth prepass, it render normal buffer last instead of decal buffer last +// and thus, we force a write of 0 if _DISABLE_DECALS so we always write in the decal buffer. +// This is required as we can't make distinction between deferred (write normal buffer) and forward (write normal buffer) +// in the context of the motion vector pass. The cost is acceptable as it is only do object with motion vector (usualy skin object) +// that most of the time use Forward Material (so are already writing motion vector data). +// So note that here unlike for depth prepass we don't check && !defined(_DISABLE_DECALS) +void Frag( VertexToPixel v2f + #ifdef WRITE_MSAA_DEPTH + // We need the depth color as SV_Target0 for alpha to coverage + , out float4 depthColor : SV_Target0 + , out float4 outMotionVector : SV_Target1 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target2 + #endif + #else + // When no MSAA, the motion vector is always the first buffer + , out float4 outMotionVector : SV_Target0 + #ifdef WRITE_DECAL_BUFFER + , out float4 outDecalBuffer : SV_Target1 + #endif + #endif + + // Decal buffer must be last as it is bind but we can optionally write into it (based on _DISABLE_DECALS) + #ifdef WRITE_NORMAL_BUFFER + , out float4 outNormalBuffer : SV_TARGET_NORMAL + #endif + + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + + FragInputs input = BuildFragInputs(v2f); + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS); + + float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS); + + + SurfaceData surfaceData; + BuiltinData builtinData; + Surface l; + ShaderData d; + GetSurfaceAndBuiltinData(v2f, input, V, posInput, surfaceData, builtinData, l, d + #if NEED_FACING + , facing + #endif + ); + + #ifdef _DEPTHOFFSET_ON + v2f.motionVectorCS.w += builtinData.depthOffset; + v2f.previousPositionCS.w += builtinData.depthOffset; + #endif + + // TODO: How to allow overriden motion vector from GetSurfaceAndBuiltinData ? + float2 motionVector = CalculateMotionVector(v2f.motionVectorCS, v2f.previousPositionCS); + + // Convert from Clip space (-1..1) to NDC 0..1 space. + // Note it doesn't mean we don't have negative value, we store negative or positive offset in NDC space. + // Note: ((positionCS * 0.5 + 0.5) - (v2f.previousPositionCS * 0.5 + 0.5)) = (motionVector * 0.5) + EncodeMotionVector(motionVector * 0.5, outMotionVector); + + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + // Setting the motionVector to a value more than 2 set as a flag for "force no motion". This is valid because, given that the velocities are in NDC, + // a value of >1 can never happen naturally, unless explicitely set. + if (forceNoMotion) + outMotionVector = float4(2.0, 0.0, 0.0, 0.0); + + // Depth and Alpha to coverage + #ifdef WRITE_MSAA_DEPTH + // In case we are rendering in MSAA, reading the an MSAA depth buffer is way too expensive. To avoid that, we export the depth to a color buffer + depthColor = v2f.pos.z; + + #ifdef _ALPHATOMASK_ON + // Alpha channel is used for alpha to coverage + depthColor.a = SharpenAlpha(builtinData.opacity, builtinData.alphaClipTreshold); + #endif + #endif + + // Normal Buffer Processing + #ifdef WRITE_NORMAL_BUFFER + EncodeIntoNormalBuffer(ConvertSurfaceDataToNormalData(surfaceData), outNormalBuffer); + #endif + + #if defined(WRITE_DECAL_BUFFER) + DecalPrepassData decalPrepassData; + // Force a write in decal buffer even if decal is disab. This is a neutral value which have no impact for later pass + #ifdef _DISABLE_DECALS + ZERO_INITIALIZE(DecalPrepassData, decalPrepassData); + #else + // We don't have the right to access SurfaceData in a shaderpass. + // However it would be painful to have to add a function like ConvertSurfaceDataToDecalPrepassData() to every Material to return geomNormalWS anyway + // Here we will put the constrain that any Material requiring to support Decal, will need to have geomNormalWS as member of surfaceData (and we already require normalWS anyway) + decalPrepassData.geomNormalWS = surfaceData.geomNormalWS; + decalPrepassData.renderingLayerMask = GetMeshRenderingLayerMask(); + #endif + EncodeIntoDecalPrepassBuffer(decalPrepassData, outDecalBuffer); + outDecalBuffer.w = (GetMeshRenderingLayerMask() & 0x000000FF) / 255.0; + #endif + + #ifdef _DEPTHOFFSET_ON + outputDepth = posInput.deviceDepth; + #endif + } + + ENDHLSL + } + + + Pass + { + Name "FullScreenDebug" + Tags + { + "LightMode" = "FullScreenDebug" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite Off + + //------------------------------------------------------------------------------------- + // End Render Modes + //------------------------------------------------------------------------------------- + + HLSLPROGRAM + + #pragma target 4.5 + #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch + + + + //#pragma shader_feature _ _SURFACE_TYPE_TRANSPARENT + //#pragma shader_feature_local _BLENDMODE_OFF _BLENDMODE_ALPHA _BLENDMODE_ADD _BLENDMODE_PRE_MULTIPLY + //#pragma shader_feature_local _ _ADD_PRECOMPUTED_VELOCITY + //#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC + //#pragma shader_feature_local _ _ENABLE_FOG_ON_TRANSPARENT + //#pragma shader_feature_local _ _DISABLE_DECALS + //#pragma shader_feature_local _ _DISABLE_SSR + //#pragma shader_feature_local _ _DISABLE_SSR_TRANSPARENT + //#pragma shader_feature_local _REFRACTION_OFF _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN + #pragma multi_compile _ LOD_FADE_CROSSFADE + + + #define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG + #define _PASSFULLSCREENDEBUG 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _HDRP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #pragma vertex Vert + #pragma fragment Frag + + // useful conversion functions to make surface shader code just work + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(tex) TEXTURE2D_ARRAY(tex); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #ifndef SHADER_STAGE_FRAGMENT + #if !defined(SHADOW_ULTRA_LOW) && !defined(SHADOW_LOW) && !defined(SHADOW_MEDIUM) && !defined(SHADOW_HIGH) // ultra low come from volumetricLighting.compute + #define SHADOW_MEDIUM + #endif + #if !defined(AREA_SHADOW_LOW) && !defined(AREA_SHADOW_MEDIUM) && !defined(AREA_SHADOW_HIGH) // low come from volumetricLighting.compute + #define AREA_SHADOW_MEDIUM + #endif + #endif + + + +// HDRP Adapter stuff + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl" // Required by Tessellation.hlsl + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Tessellation.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" // Required to be include before we include properties as it define DECLARE_STACK_CB + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" // Required before including properties as it defines UNITY_TEXTURE_STREAMING_DEBUG_VARS + // Always include Shader Graph version + // Always include last to avoid double macros + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // Need to be here for Gradient struct definition + + +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" + + + + #ifdef RAYTRACING_SHADER_GRAPH_DEFAULT + #define RAYTRACING_SHADER_GRAPH_HIGH + #endif + + #ifdef RAYTRACING_SHADER_GRAPH_RAYTRACED + #define RAYTRACING_SHADER_GRAPH_LOW + #endif + // end + + + + + // If we use subsurface scattering, enable output split lighting (for forward pass) + #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define OUTPUT_SPLIT_LIGHTING + #endif + + #define HAVE_RECURSIVE_RENDERING + + #if SHADERPASS == SHADERPASS_TRANSPARENT_DEPTH_PREPASS + #if !defined(_DISABLE_SSR_TRANSPARENT) && !defined(SHADER_UNLIT) + #define WRITE_NORMAL_BUFFER + #endif + #endif + + #ifndef DEBUG_DISPLAY + // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) + // Don't do it with debug display mode as it is possible there is no depth prepass in this case + #if !defined(_SURFACE_TYPE_TRANSPARENT) && defined(_ALPHATEST) + #if SHADERPASS == SHADERPASS_FORWARD + #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST + #elif SHADERPASS == SHADERPASS_GBUFFER + #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST + #endif + #endif + #endif + + // Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass + #if defined(SHADER_LIT) && !defined(_SURFACE_TYPE_TRANSPARENT) + #define _DEFERRED_CAPABLE_MATERIAL + #endif + + // Translate transparent motion vector define + #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) + #define _WRITE_TRANSPARENT_MOTION_VECTOR + #endif + + + + + CBUFFER_START(UnityPerMaterial) + float _UseShadowThreshold; + float _BlendMode; + float _EnableBlendModePreserveSpecularLighting; + float _RayTracing; + float _RefractionModel; + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + // -- Property used by ScenePickingPass + #ifdef SCENEPICKINGPASS + float4 _SelectionID; + #endif + + // -- Properties used by SceneSelectionPass + #ifdef SCENESELECTIONPASS + int _ObjectId; + int _PassValue; + #endif + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD15; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + UNITY_VERTEX_INPUT_INSTANCE_ID + #endif // UNITY_ANY_INSTANCING_ENABLED + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + float4 previousPositionCS : TEXCOORD16; // Contain previous transform position (in case of skinning for example) + float4 motionVectorCS : TEXCOORD17; + #endif + + UNITY_VERTEX_OUTPUT_STEREO + }; + + + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/MaterialUtilities.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl" + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + +#if (SHADERPASS == SHADERPASS_LIGHT_TRANSPORT) + + // This was not in constant buffer in original unity, so keep outiside. But should be in as ShaderRenderPass frequency + float unity_OneOverOutputBoost; + float unity_MaxOutputValue; + + CBUFFER_START(UnityMetaPass) + // x = use uv1 as raster position + // y = use uv2 as raster position + bool4 unity_MetaVertexControl; + + // x = return albedo + // y = return normal + bool4 unity_MetaFragmentControl; + CBUFFER_END + + VertexToPixel Vert(VertexData inputMesh) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + UNITY_SETUP_INSTANCE_ID(inputMesh); + UNITY_TRANSFER_INSTANCE_ID(inputMesh, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Output UV coordinate in vertex shader + float2 uv = float2(0.0, 0.0); + + if (unity_MetaVertexControl.x) + { + uv = inputMesh.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + else if (unity_MetaVertexControl.y) + { + uv = inputMesh.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + } + + // OpenGL right now needs to actually use the incoming vertex position + // so we create a fake dependency on it here that haven't any impact. + output.pos = float4(uv * 2.0 - 1.0, inputMesh.vertex.z > 0 ? 1.0e-4 : 0.0, 1.0); + + output.worldPos = TransformObjectToWorld(inputMesh.vertex.xyz).xyz; + + // Normal is required for triplanar mapping + output.worldNormal = TransformObjectToWorldNormal(inputMesh.normal); + // Not required but assign to silent compiler warning + output.worldTangent = float4(1.0, 0.0, 0.0, 0.0); + + output.texcoord0 = inputMesh.texcoord0; + output.texcoord1 = inputMesh.texcoord1; + output.texcoord2 = inputMesh.texcoord2; + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = inputMesh.texcoord3; + // #endif + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = inputMesh.vertexColor; + // #endif + + return output; + } +#else + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesMatrixDefsHDCamera.hlsl" + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + VertexToPixel Vert(VertexData input) + { + VertexToPixel output; + ZERO_INITIALIZE(VertexToPixel, output); + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = input; + #endif + + ChainModifyVertex(input, output, _Time); + + // This return the camera relative position (if enable) + float3 positionRWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangent.xyz), input.tangent.w); + + + output.worldPos = GetAbsolutePositionWS(positionRWS); + output.pos = TransformWorldToHClip(positionRWS); + output.worldNormal = normalWS; + output.worldTangent = tangentWS; + + + output.texcoord0 = input.texcoord0; + output.texcoord1 = input.texcoord1; + output.texcoord2 = input.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + output.texcoord3 = input.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + output.vertexColor = input.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // output.screenPos = ComputeScreenPos(output.pos, _ProjectionParams.x); + // #endif + + #if _HDRP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(output); + #endif + + output.motionVectorCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionRWS.xyz, 1.0)); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + { + output.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + } + else + { + bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target + + float3 effectivePositionOS = (hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz); + #if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= input.precomputedVelocity; + #endif + + previousMesh.vertex = float4(effectivePositionOS, 1); + VertexToPixel dummy = (VertexToPixel)0; + + + ChainModifyVertex(previousMesh, dummy, _LastTimeParameters); + + // we might need this for skinned objects? + //float3 normalWS = TransformPreviousObjectToWorldNormal(input.normal).xyz; + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.vertex.xyz); + + #ifdef _WRITE_TRANSPARENT_MOTION_VECTOR + if (_TransparentCameraOnlyMotionVectors > 0) + { + previousPositionRWS = positionRWS.xyz; + } + #endif // _WRITE_TRANSPARENT_MOTION_VECTOR + + output.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionRWS, 1.0)); + } + #endif // _HDRP && _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + + + return output; + } + + +#endif + + + + + + + + #if defined(WRITE_DECAL_BUFFER) && !defined(_DISABLE_DECALS) + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalPrepassBuffer.hlsl" + #endif + + FragInputs BuildFragInputs(VertexToPixel input) + { + UNITY_SETUP_INSTANCE_ID(input); + FragInputs output; + ZERO_INITIALIZE(FragInputs, output); + + // Init to some default value to make the computer quiet (else it output 'divide by zero' warning even if value is not used). + // TODO: this is a really poor workaround, but the variable is used in a bunch of places + // to compute normals which are then passed on elsewhere to compute other values... + output.tangentToWorld = k_identity3x3; + output.positionSS = input.pos; // input.positionCS is SV_Position + // BETTER SHADERS: because we transform world position into actual world space for things like + // triplanar, etc, we have to back transform it here for lighting + output.positionRWS = GetCameraRelativePositionWS(input.worldPos); + output.tangentToWorld = BuildTangentToWorld(input.worldTangent, input.worldNormal); + output.texCoord0 = input.texcoord0; + output.texCoord1 = input.texcoord1; + output.texCoord2 = input.texcoord2; + + return output; + } + +#if UNITY_VERSION > UNITY_2022_3_12 + void ApplyDecalAndGetNormal(FragInputs fragInputs, PositionInputs posInput, Surface surfaceDescription, float3 normalTS, + inout SurfaceData surfaceData) + { + float3 doubleSidedConstants = GetDoubleSidedConstants(); + + #ifdef DECAL_NORMAL_BLENDING + // SG nodes don't ouptut surface gradients, so if decals require surf grad blending, we have to convert + // the normal to gradient before applying the decal. We then have to resolve the gradient back to world space + normalTS = SurfaceGradientFromTangentSpaceNormalAndFromTBN(normalTS, + fragInputs.tangentToWorld[0], fragInputs.tangentToWorld[1]); + + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, fragInputs.tangentToWorld[2], normalTS); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + + GetNormalWS_SG(fragInputs, normalTS, surfaceData.normalWS, doubleSidedConstants); + #else + // normal delivered to master node + + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceNormal(decalSurfaceData, surfaceData.normalWS.xyz); + ApplyDecalToSurfaceDataNoNormal(decalSurfaceData, surfaceData); + } + #endif + #endif + } +#endif + + void BuildSurfaceData(FragInputs fragInputs, inout Surface surfaceDescription, float3 V, PositionInputs posInput, out SurfaceData surfaceData, out float3 bentNormalWS) + { + // setup defaults -- these are used if the graph doesn't output a value + ZERO_INITIALIZE(SurfaceData, surfaceData); + + // specularOcclusion need to be init ahead of decal to quiet the compiler that modify the SurfaceData struct + // however specularOcclusion can come from the graph, so need to be init here so it can be override. + surfaceData.specularOcclusion = 1.0; + + // copy across graph values, if defined + surfaceData.baseColor = surfaceDescription.Albedo; + surfaceData.perceptualSmoothness = surfaceDescription.Smoothness; + surfaceData.ambientOcclusion = surfaceDescription.Occlusion; + surfaceData.specularOcclusion = surfaceDescription.SpecularOcclusion; + surfaceData.metallic = surfaceDescription.Metallic; + surfaceData.subsurfaceMask = surfaceDescription.SubsurfaceMask; + surfaceData.thickness = surfaceDescription.Thickness; + surfaceData.diffusionProfileHash = asuint(surfaceDescription.DiffusionProfileHash); + #if _USESPECULAR + surfaceData.specularColor = surfaceDescription.Specular; + #endif + surfaceData.coatMask = surfaceDescription.CoatMask; + surfaceData.anisotropy = surfaceDescription.Anisotropy; + surfaceData.iridescenceMask = surfaceDescription.IridescenceMask; + surfaceData.iridescenceThickness = surfaceDescription.IridescenceThickness; + + + + #if defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE) || defined(_REFRACTION_THIN) + if (_EnableSSRefraction) + { + surfaceData.transmittanceMask = (1.0 - surfaceDescription.Alpha); + surfaceDescription.Alpha = 1.0; + } + else + { + surfaceData.ior = surfaceDescription.ior; + surfaceData.transmittanceColor = surfaceDescription.transmittanceColor; + surfaceData.atDistance = surfaceDescription.atDistance; + surfaceData.transmittanceMask = surfaceDescription.transmittanceMask; + surfaceDescription.Alpha = 1.0; + } + #else + surfaceData.ior = 1.0; + surfaceData.transmittanceColor = float3(1.0, 1.0, 1.0); + surfaceData.atDistance = 1.0; + surfaceData.transmittanceMask = 0.0; + #endif + + + + // These static material feature allow compile time optimization + surfaceData.materialFeatures = MATERIALFEATUREFLAGS_LIT_STANDARD; + #ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING; + #endif + + #ifdef _MATERIAL_FEATURE_TRANSMISSION + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_TRANSMISSION; + #endif + + #ifdef _MATERIAL_FEATURE_ANISOTROPY + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY; + surfaceData.normalWS = float3(0, 1, 0); + #endif + + #ifdef _MATERIAL_FEATURE_IRIDESCENCE + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_IRIDESCENCE; + #endif + + #ifdef _MATERIAL_FEATURE_SPECULAR_COLOR + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_SPECULAR_COLOR; + #endif + + #if defined(_MATERIAL_FEATURE_CLEAR_COAT) || _CLEARCOAT + surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_CLEAR_COAT; + #endif + + #if defined (_MATERIAL_FEATURE_SPECULAR_COLOR) && defined (_ENERGY_CONSERVING_SPECULAR) + // Require to have setup baseColor + // Reproduce the energy conservation done in legacy Unity. Not ideal but better for compatibility and users can unchek it + surfaceData.baseColor *= (1.0 - Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b)); + #endif + + float3 normalTS = surfaceDescription.Normal; + #if !_WORLDSPACENORMAL + surfaceData.normalWS = mul(surfaceDescription.Normal, fragInputs.tangentToWorld); + #else + normalTS = mul(fragInputs.tangentToWorld, surfaceDescription.Normal); + surfaceData.normalWS = surfaceDescription.Normal; + #endif + + + #if UNITY_VERSION > UNITY_2022_3_12 + ApplyDecalAndGetNormal(fragInputs, posInput, surfaceDescription, normalTS, surfaceData); + #else + #ifdef DECAL_NORMAL_BLENDING + #if HAVE_DECALS + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + if (_EnableDecals) + { + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData, normalTS); + } + #endif + #else + #if HAVE_DECALS + if (_EnableDecals) + { + float alpha = 1.0; + alpha = surfaceDescription.Alpha; + // Both uses and modifies 'surfaceData.normalWS'. + DecalSurfaceData decalSurfaceData = GetDecalSurfaceData(posInput, fragInputs, alpha); + ApplyDecalToSurfaceData(decalSurfaceData, fragInputs.tangentToWorld[2], surfaceData); + } + #endif + #endif + #endif + + + + surfaceData.geomNormalWS = fragInputs.tangentToWorld[2]; + + surfaceData.tangentWS = normalize(fragInputs.tangentToWorld[0].xyz); // The tangent is not normalize in tangentToWorld for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT + + + bentNormalWS = surfaceData.normalWS; + + surfaceData.tangentWS = Orthonormalize(surfaceData.tangentWS, surfaceData.normalWS); + + #ifdef DEBUG_DISPLAY + if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE) + { + // TODO: need to update mip info + surfaceData.metallic = 0; + } + + // We need to call ApplyDebugToSurfaceData after filling the surfarcedata and before filling builtinData + // as it can modify attribute use for static lighting + ApplyDebugToSurfaceData(fragInputs.tangentToWorld, surfaceData); + #endif + + // By default we use the ambient occlusion with Tri-ace trick (apply outside) for specular occlusion. + // If user provide bent normal then we process a better term + #if defined(_SPECULAR_OCCLUSION_CUSTOM) + // Just use the value passed through via the slot (not active otherwise) + #elif defined(_SPECULAR_OCCLUSION_FROM_AO_BENT_NORMAL) + // If we have bent normal and ambient occlusion, process a specular occlusion + surfaceData.specularOcclusion = GetSpecularOcclusionFromBentAO(V, bentNormalWS, surfaceData.normalWS, surfaceData.ambientOcclusion, PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness)); + #elif defined(_AMBIENT_OCCLUSION) && defined(_SPECULAR_OCCLUSION_FROM_AO) + surfaceData.specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(ClampNdotV(dot(surfaceData.normalWS, V)), surfaceData.ambientOcclusion, PerceptualSmoothnessToRoughness(surfaceData.perceptualSmoothness)); + #endif + + #if defined(_ENABLE_GEOMETRIC_SPECULAR_AA) && !defined(SHADER_STAGE_RAY_TRACING) + surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, fragInputs.tangentToWorld[2], surfaceDescription.SpecularAAScreenSpaceVariance, surfaceDescription.SpecularAAThreshold); + #endif + } + + void GetSurfaceAndBuiltinData(VertexToPixel m2ps, FragInputs fragInputs, float3 V, inout PositionInputs posInput, + out SurfaceData surfaceData, out BuiltinData builtinData, inout Surface l, inout ShaderData d + #if NEED_FACING + , bool facing + #endif + ) + { + // Removed since crossfade does not work, probably needs extra material setup. + //#if !defined(SHADER_STAGE_RAY_TRACING) && !defined(_TESSELLATION_DISPLACEMENT) + // #ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group + // LODDitheringTransition(ComputeFadeMaskSeed(V, posInput.positionSS), unity_LODFade.x); + // #endif + //#endif + + + + + d = CreateShaderData(m2ps + #if NEED_FACING + , facing + #endif + ); + + l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + l.SpecularOcclusion = 1; + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + l.outputDepth = d.clipPos.z; + #endif + + ChainSurfaceFunction(l, d); + + #if !defined(SHADER_STAGE_RAY_TRACING) && defined(_DEPTHOFFSET_ON) + posInput.deviceDepth = l.outputDepth; + #endif + + #if _UNLIT + //l.Emission = l.Albedo; + //l.Albedo = 0; + l.Normal = half3(0,0,1); + l.Occlusion = 1; + l.Metallic = 0; + l.Specular = 0; + #endif + + surfaceData.geomNormalWS = d.worldSpaceNormal; + surfaceData.tangentWS = d.worldSpaceTangent; + fragInputs.tangentToWorld = d.TBNMatrix; + + float3 bentNormalWS; + + BuildSurfaceData(fragInputs, l, V, posInput, surfaceData, bentNormalWS); + + + float4 lightmapTexCoord1 = fragInputs.texCoord1; + float4 lightmapTexCoord2 = fragInputs.texCoord2; + //#ifdef FRAG_INPUTS_USE_TEXCOORD1 + // float4 lightmapTexCoord1 = fragInputs.texCoord1; + // #else + // float4 lightmapTexCoord1 = float4(0,0,0,0); + // #endif + + // #ifdef FRAG_INPUTS_USE_TEXCOORD2 + // float4 lightmapTexCoord2 = fragInputs.texCoord2; + // #else + // float4 lightmapTexCoord2 = float4(0,0,0,0); + // #endif + + + InitBuiltinData(posInput, l.Alpha, bentNormalWS, -d.worldSpaceNormal, lightmapTexCoord1, lightmapTexCoord2, builtinData); + + + + builtinData.emissiveColor = l.Emission; + + #if defined(_OVERRIDE_BAKEDGI) + builtinData.bakeDiffuseLighting = l.DiffuseGI; + builtinData.backBakeDiffuseLighting = l.BackDiffuseGI; + builtinData.emissiveColor += l.SpecularGI; + #endif + + #if defined(_OVERRIDE_SHADOWMASK) + builtinData.shadowMask0 = l.ShadowMask.x; + builtinData.shadowMask1 = l.ShadowMask.y; + builtinData.shadowMask2 = l.ShadowMask.z; + builtinData.shadowMask3 = l.ShadowMask.w; + #endif + + #ifdef UNITY_VIRTUAL_TEXTURING + //builtinData.vtPackedFeedback = surfaceData.VTPackedFeedback; + #endif + + #if (SHADERPASS == SHADERPASS_DISTORTION) + builtinData.distortion = surfaceData.Distortion; + builtinData.distortionBlur = surfaceData.DistortionBlur; + #endif + + #ifndef SHADER_UNLIT + // PostInitBuiltinData call ApplyDebugToBuiltinData + PostInitBuiltinData(V, posInput, surfaceData, builtinData); + #else + ApplyDebugToBuiltinData(builtinData); + #endif + + RAY_TRACING_OPTIONAL_ALPHA_TEST_PASS + } + + + +#define DEBUG_DISPLAY +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/FullScreenDebug.hlsl" + + #if !defined(_DEPTHOFFSET_ON) + [earlydepthstencil] // quad overshading debug mode writes to UAV + #endif + void Frag(VertexToPixel v2f + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v2f); + FragInputs input = BuildFragInputs(v2f); + + PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz); + + #ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_QUAD_OVERDRAW) + { + IncrementQuadOverdrawCounter(posInput.positionSS.xy, input.primitiveID); + } + #endif + } + + ENDHLSL + } + + + + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt.meta new file mode 100644 index 00000000..c5a3d0dd --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a1f8afb0017813b4aac0394c15f9f2a5 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_HDRP2023.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt new file mode 100644 index 00000000..193a02b2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt @@ -0,0 +1,17416 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: Standard +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + } + SubShader + { + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" } + + + + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + CGPROGRAM + // compile directives + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma multi_compile_fwdbase + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + // -------- variant for: + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + #define SHADER_PASS SHADERPASS_FORWARD + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + float4 lmap : TEXCOORD8; + #if UNITY_SHOULD_SAMPLE_SH + half3 sh : TEXCOORD9; // SH + #endif + #ifdef LIGHTMAP_ON + UNITY_LIGHTING_COORDS(10,11) + UNITY_FOG_COORDS(12) + #else + UNITY_FOG_COORDS(10) + UNITY_SHADOW_COORDS(11) + #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #endif + + // SH/ambient and vertex lights + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + // Approximated illumination from non-important point lights + #ifdef VERTEXLIGHT_ON + o.sh += Shade4PointLights ( + unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0, + unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb, + unity_4LightAtten0, o.worldPos, o.worldNormal); + #endif + o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); + #endif + #endif // !LIGHTMAP_ON + + UNITY_TRANSFER_LIGHTING(o,v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_TRANSFER_FOG_COMBINED_WITH_TSPACE(o,o.pos); // pass fog coordinates to pixel shader + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_TRANSFER_FOG_COMBINED_WITH_WORLD_POS(o,o.pos); // pass fog coordinates to pixel shader + #else + UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader + #endif + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + // compute lighting & shadowing factor + UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.Specular; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + fixed4 c = 0; + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + // Call GI (lightmaps/SH/reflections) lighting function + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = d.worldSpacePosition; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + gi.light.color *= mulColor; + giInput.light.color *= mulColor; + #endif + + #if _UNLIT + c.rgb = l.Albedo; + c.a = l.Alpha; + #elif _BDRF3 || _SIMPLELIT + LightingBlinnPhong_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); + #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + LightingStandardSpecular_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingStandardSpecular (o, d.worldSpaceViewDir, gi); + #else + LightingStandard_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + c += LightingStandard (o, d.worldSpaceViewDir, gi); + #endif + + c.rgb += o.Emission; + + ChainFinalColorForward(l, d, c); + + #if !DISABLEFOG + UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog + #endif + + + return c; + } + + ENDCG + + } + + + + // ---- deferred shading pass: + Pass + { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + + Cull [_CullingOption] + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma exclude_renderers nomrt + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_prepassfinal + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + #define _PASSGBUFFER 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + #ifndef DIRLIGHTMAP_OFF + float3 viewDir : TEXCOORD8; + #endif + float4 lmap : TEXCOORD9; + #ifndef LIGHTMAP_ON + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + half3 sh : TEXCOORD10; // SH + #endif + #else + #ifdef DIRLIGHTMAP_OFF + float4 lmapFadePos : TEXCOORD11; + #endif + #endif + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + float3 viewDirForLight = UnityWorldSpaceViewDir(o.worldPos); + #ifndef DIRLIGHTMAP_OFF + float3 worldBinormal = cross(o.worldNormal, o.worldTangent.xyz); + o.viewDir.x = dot(viewDirForLight, o.worldTangent.xyz); + o.viewDir.y = dot(viewDirForLight, worldBinormal); + o.viewDir.z = dot(viewDirForLight, o.worldNormal); + #endif + #ifdef DYNAMICLIGHTMAP_ON + o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #else + o.lmap.zw = 0; + #endif + #ifdef LIGHTMAP_ON + o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + #ifdef DIRLIGHTMAP_OFF + o.lmapFadePos.xyz = (mul(GetObjectToWorldMatrix(), v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w; + o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); + #endif + #else + o.lmap.xy = 0; + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + o.sh = 0; + o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); + #endif + #endif + + return o; + } + + + + #ifdef LIGHTMAP_ON + float4 unity_LightmapFade; + #endif + fixed4 unity_Ambient; + + + + // fragment shader + void Frag (VertexToPixel IN, + out half4 outGBuffer0 : SV_Target0, + out half4 outGBuffer1 : SV_Target1, + out half4 outGBuffer2 : SV_Target2, + out half4 outEmission : SV_Target3 + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + , out half4 outShadowMask : SV_Target4 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.SpecularPower; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + + half atten = 1; + + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = 0; + gi.light.dir = half3(0,1,0); + // Call GI (lightmaps/SH/reflections) lighting function + UnityGIInput giInput; + UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); + giInput.light = gi.light; + giInput.worldPos = d.worldSpacePosition; + giInput.worldViewDir = worldViewDir; + giInput.atten = atten; + #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) + giInput.lightmapUV = IN.lmap; + #else + giInput.lightmapUV = 0.0; + #endif + #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL + giInput.ambient = IN.sh; + #else + giInput.ambient.rgb = 0.0; + #endif + giInput.probeHDR[0] = unity_SpecCube0_HDR; + giInput.probeHDR[1] = unity_SpecCube1_HDR; + #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) + giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending + #endif + #ifdef UNITY_SPECCUBE_BOX_PROJECTION + giInput.boxMax[0] = unity_SpecCube0_BoxMax; + giInput.probePosition[0] = unity_SpecCube0_ProbePosition; + giInput.boxMax[1] = unity_SpecCube1_BoxMax; + giInput.boxMin[1] = unity_SpecCube1_BoxMin; + giInput.probePosition[1] = unity_SpecCube1_ProbePosition; + #endif + + + + #if _BDRF3 || _SIMPLELIT + + LightingBlinnPhong_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + + outEmission = LightingBlinnPhong_Deferred(o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + LightingStandardSpecular_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + // call lighting function to output g-buffer + outEmission = LightingStandardSpecular_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #else + LightingStandard_GI(o, giInput, gi); + #if defined(_OVERRIDE_BAKEDGI) + gi.indirect.diffuse = l.DiffuseGI; + gi.indirect.specular = l.SpecularGI; + #endif + // call lighting function to output g-buffer + outEmission = LightingStandard_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #endif + #ifndef UNITY_HDR_ON + outEmission.rgb = exp2(-outEmission.rgb); + #endif + #endif + + #if defined(_OVERRIDE_SHADOWMASK) && defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + outShadowMask = mulColor; + #endif + + #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) + ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); + #else + half4 outShadowMask = 0; + ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); + #endif + + + } + + + + + ENDCG + + } + + + + + // ---- forward rendering additive lights pass: + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardAdd" } + ZWrite Off Blend One One + + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma skip_variants INSTANCING_ON + #pragma multi_compile_fwdadd_fullshadows + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "AutoLight.cginc" + + + + #define _PASSFORWARD 1 + #define _PASSFORWARDADD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + UNITY_LIGHTING_COORDS(8,9) + UNITY_FOG_COORDS(10) + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD18; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.pos = UnityObjectToClipPos(v.vertex); + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + UNITY_TRANSFER_LIGHTING(o, v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader + UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + + #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + #else + SurfaceOutputStandardSpecular o; + #endif + o.Specular = l.Specular; + o.Occlusion = l.Occlusion; + o.Smoothness = l.Smoothness; + #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT + #ifdef UNITY_COMPILER_HLSL + SurfaceOutput o = (SurfaceOutput)0; + #else + SurfaceOutput o; + #endif + + o.Specular = l.SpecularPower; + o.Gloss = l.Smoothness; + _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. + #else + #ifdef UNITY_COMPILER_HLSL + SurfaceOutputStandard o = (SurfaceOutputStandard)0; + #else + SurfaceOutputStandard o; + #endif + o.Smoothness = l.Smoothness; + o.Metallic = l.Metallic; + o.Occlusion = l.Occlusion; + #endif + + + o.Albedo = l.Albedo; + o.Emission = l.Emission; + o.Alpha = l.Alpha; + + #if _WORLDSPACENORMAL + o.Normal = l.Normal; + #else + o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + + + UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) + half4 c = 0; + + // Setup lighting environment + UnityGI gi; + UNITY_INITIALIZE_OUTPUT(UnityGI, gi); + gi.indirect.diffuse = 0; + gi.indirect.specular = 0; + gi.light.color = _LightColor0.rgb; + gi.light.dir = lightDir; + gi.light.color *= atten; + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); + gi.light.color *= mulColor; + #endif + + #if _USESPECULAR + c += LightingStandardSpecular (o, worldViewDir, gi); + #elif _BDRF3 || _SIMPLELIT + c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); + #else + c += LightingStandard (o, worldViewDir, gi); + #endif + + + ChainFinalColorForward(l, d, c); + + #if !DISABLEFOG + UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog + #endif + #if !_ALPHABLEND_ON + UNITY_OPAQUE_ALPHA(c.a); + #endif + + return c; + } + + ENDCG + + } + + + Pass { + Name "ShadowCaster" + Tags { "LightMode" = "ShadowCaster" } + ZWrite On ZTest LEqual + + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma multi_compile_shadowcaster + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + V2F_SHADOW_CASTER; // may declare TEXCOORD0 for the wonderfully named .vec + float3 worldPos : TEXCOORD1; + float3 worldNormal : TEXCOORD2; + float4 worldTangent : TEXCOORD3; + float4 texcoord0 : TEXCOORD4; + float4 texcoord1 : TEXCOORD5; + float4 texcoord2 : TEXCOORD6; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD7; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD8; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD16; + // #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + // sets o.pos, so do screenpos after. + TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + // prepare and unpack data + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + #ifndef USING_DIRECTIONAL_LIGHT + fixed3 lightDir = normalize(UnityWorldSpaceLightDir(IN.worldPos)); + #else + fixed3 lightDir = _WorldSpaceLightPos0.xyz; + #endif + + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + SHADOW_CASTER_FRAGMENT(IN) + } + + + ENDCG + + } + + + // ---- meta information extraction pass: + Pass + { + Name "Meta" + Tags { "LightMode" = "Meta" } + Cull Off + + + + CGPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + // compile directives + #pragma target 3.0 + #pragma multi_compile_instancing + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 + #pragma shader_feature EDITOR_VISUALIZATION + + #include "HLSLSupport.cginc" + #define UNITY_INSTANCED_LOD_FADE + #define UNITY_INSTANCED_SH + #define UNITY_INSTANCED_LIGHTMAPSTS + #include "UnityShaderVariables.cginc" + #include "UnityShaderUtilities.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + #include "UnityMetaPass.cginc" + + #define _PASSMETA 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _STANDARD 1 +// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same +// texturing library they use. However, since they are not included in the standard pipeline by default, there is no +// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without +// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead +// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not +// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + +#if defined(SHADER_API_GAMECORE) + + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r + #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_XBOXONE) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + +#elif defined(SHADER_API_PSSL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName + #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + + + +#elif defined(SHADER_API_D3D11) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_METAL) + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_VULKAN) +// This file assume SHADER_API_VULKAN is defined + // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. + + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_SWITCH) + // This file assume SHADER_API_SWITCH is defined + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + +#elif defined(SHADER_API_GLCORE) + + // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 46) + #define OPENGL4_1_SM5 1 + #else + #define OPENGL4_1_SM5 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) + #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + + #if OPENGL4_1_SM5 + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #endif + + + #elif defined(SHADER_API_GLES3) + + // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html + #if (SHADER_TARGET >= 40) + #define GLES3_1_AEP 1 + #else + #define GLES3_1_AEP 0 + #endif + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) + + // Texture abstraction + + #define TEXTURE2D(textureName) Texture2D textureName + #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName + #define TEXTURECUBE(textureName) TextureCube textureName + #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName + #define TEXTURE3D(textureName) Texture3D textureName + + #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName + + #define TEXTURE2D_HALF(textureName) Texture2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added + #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added + #define TEXTURE3D_HALF(textureName) Texture3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) + #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) + + #if GLES3_1_AEP + #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName + #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName + #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName + #else + #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + #endif + + #define SAMPLER(samplerName) SamplerState samplerName + #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName + + #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) + #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) + + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) + #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName + + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) + + #ifdef UNITY_NO_CUBEMAP_ARRAY + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #else + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) + #endif + + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) + + + #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) + #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) + + #if GLES3_1_AEP + #define PLATFORM_SUPPORT_GATHER + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) + #else + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + #endif + + +#elif defined(SHADER_API_GLES) + + + #define uint int + + #define rcp(x) 1.0 / (x) + #define ddx_fine ddx + #define ddy_fine ddy + #define asfloat + #define asuint(x) asint(x) + #define f32tof16 + #define f16tof32 + + #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 + + // Initialize arbitrary structure with zero values. + // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 + #define ZERO_INITIALIZE(type, name) name = (type)0; + #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } + + + // Texture util abstraction + + #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 + + // Texture abstraction + + #define TEXTURE2D(textureName) sampler2D textureName + #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray + #define TEXTURECUBE(textureName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray + #define TEXTURE3D(textureName) sampler3D textureName + + #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName + #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray + #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName + #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray + #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName + + #define TEXTURE2D_HALF(textureName) sampler2D_half textureName + #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray + #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName + #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray + #define TEXTURE3D_HALF(textureName) sampler3D_half textureName + + #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array + + #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) + #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) + #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) + + #define SAMPLER(samplerName) + #define SAMPLER_CMP(samplerName) + + #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName + #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName + #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName + #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName + #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName + + #define TEXTURE2D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName + #define TEXTURE3D_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName + #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName + + #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) + + #if (SHADER_TARGET >= 30) + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) + #else + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) + #endif + + #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) + #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) + #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) + #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) + #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) + #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) + // No lod support. Very poor approximation with bias. + #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) + #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) + #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) + #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) + #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) + #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) + #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) + + #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) + #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) + #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) + #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) + + + // Not supported. Can't define as error because shader library is calling these functions. + #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) + #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) + #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) + #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) + + // Gather not supported. Fallback to regular texture sampling. + #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) + #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) + #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) + #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) + #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) + #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) + #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) + #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) + +#else +#error unsupported shader api +#endif + + + + +// default flow control attributes +#ifndef UNITY_BRANCH +# define UNITY_BRANCH +#endif +#ifndef UNITY_FLATTEN +# define UNITY_FLATTEN +#endif +#ifndef UNITY_UNROLL +# define UNITY_UNROLL +#endif +#ifndef UNITY_UNROLLX +# define UNITY_UNROLLX(_x) +#endif +#ifndef UNITY_LOOP +# define UNITY_LOOP +#endif + + + +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + UNITY_POSITION(pos); + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + #ifdef EDITOR_VISUALIZATION + float2 vizUV : TEXCOORD8; + float4 lightCoord : TEXCOORD9; + #endif + + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD17; + // #endif + + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef UNITY_MATRIX_I_M + + #define UNITY_MATRIX_I_M unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + UNITY_SETUP_INSTANCE_ID(v); + VertexToPixel o; + UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); + UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + + o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #ifdef EDITOR_VISUALIZATION + o.vizUV = 0; + o.lightCoord = 0; + if (unity_VisualizationMode == EDITORVIZ_TEXTURE) + o.vizUV = UnityMetaVizUV(unity_EditorViz_UVIndex, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, unity_EditorViz_Texture_ST); + else if (unity_VisualizationMode == EDITORVIZ_SHOWLIGHTMASK) + { + o.vizUV = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + o.lightCoord = mul(unity_EditorViz_WorldToLight, mul(GetObjectToWorldMatrix(), float4(v.vertex.xyz, 1))); + } + #endif + + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos); + // #endif + + o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; + o.worldNormal = UnityObjectToWorldNormal(v.normal); + o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + return o; + } + + + + // fragment shader + fixed4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #ifdef FOG_COMBINED_WITH_TSPACE + UNITY_EXTRACT_FOG_FROM_TSPACE(IN); + #elif defined FOG_COMBINED_WITH_WORLD_POS + UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); + #else + UNITY_EXTRACT_FOG(IN); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + + ChainSurfaceFunction(l, d); + + UnityMetaInput metaIN; + UNITY_INITIALIZE_OUTPUT(UnityMetaInput, metaIN); + metaIN.Albedo = l.Albedo; + metaIN.Emission = l.Emission; + + #if _USESPECULAR + metaIN.SpecularColor = l.Specular; + #endif + + #ifdef EDITOR_VISUALIZATION + metaIN.VizUV = IN.vizUV; + metaIN.LightCoord = IN.lightCoord; + #endif + return UnityMetaFragment(metaIN); + } + ENDCG + + } + + + + + + } + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt.meta new file mode 100644 index 00000000..16807242 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: d0469e88f445d184f88bc25be7464884 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_Standard.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt new file mode 100644 index 00000000..fb61079a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt @@ -0,0 +1,4834 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: URP2019 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Opaque" "Queue" = "Geometry" } + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + + // Keywords + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE + #pragma multi_compile _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS _ADDITIONAL_OFF + #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile _ _SHADOWS_SOFT + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + + // GraphKeywords: + + + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define SHADER_PASS SHADERPASS_FORWARD + #define SHADERPASS_FORWARD + + #define _PASSFORWARD 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if defined(_USESPECULAR) || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + InputData inputData; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + + #if !_UNLIT + #if _SIMPLELIT + half4 color = UniversalFragmentBlinnPhong( + inputData, + l.Albedo, + float4(specular * l.Smoothness, 0), + l.SpecularPower * 128, + l.Emission, + l.Alpha); + color.a = l.Alpha; + #elif _BAKEDLIT + half4 color = color = UniversalFragmentBakedLit(inputData, l.Albedo, l.Alpha, normalTS); + #else + half4 color = UniversalFragmentPBR( + inputData, + l.Albedo, + metallic, + specular, + l.Smoothness, + l.Occlusion, + l.Emission, + l.Alpha); + #endif + + #else + half4 color = half4(l.Albedo, l.Alpha); + #endif + + #if _UNLITFOG && !DISABLEFOG + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + + ChainFinalColorForward(l, d, color); + + return color; + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS_SHADOWCASTER + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + float4 fogFactorAndVertexLight : TEXCOORD10; + float4 shadowCoord : TEXCOORD11; + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1, v.texcoord2, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD + OUTPUT_LIGHTMAP_UV(v.texcoord1, unity_LightmapST, o.lightmapUV); + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #ifdef _MAIN_LIGHT_SHADOWS + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt.meta new file mode 100644 index 00000000..61c66f6e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 3a9baa42d2bd0f2418209ef9ad138f0e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2019.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt new file mode 100644 index 00000000..4e822acb --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt @@ -0,0 +1,4888 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: URP2020 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Opaque" "UniversalMaterialType" = "Lit" "Queue" = "Geometry" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile _ DOTS_INSTANCING_ON + + // Keywords + #pragma multi_compile _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE + #pragma multi_compile _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS _ADDITIONAL_OFF + #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #endif + + #if !_UNLIT + #if _SIMPLELIT + half4 color = UniversalFragmentBlinnPhong( + inputData, + l.Albedo, + float4(specular * l.Smoothness, 0), + l.SpecularPower * 128, + l.Emission, + l.Alpha); + color.a = l.Alpha; + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, l.Albedo, l.Alpha, normalTS); + #else + + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + half4 color = UniversalFragmentPBR(inputData, surface); + + #endif + + #else + half4 color = half4(l.Albedo, l.Alpha); + + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, IN.fogFactorAndVertexLight.x); + #endif + ChainFinalColorForward(l, d, color); + + return color; + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define SHADERPASS_SHADOWCASTER + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD12; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD19; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD9; + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + float4 fogFactorAndVertexLight : TEXCOORD10; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD11; + #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if _PASSSHADOW + float3 _LightDirection; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + + #if _PASSSHADOW + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, _LightDirection)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #if _BAKEDLIT + half3 vertexLight = 0; + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + #endif + half fogFactor = ComputeFogFactor(o.pos.z); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt.meta new file mode 100644 index 00000000..0c1eb8f9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: aa67532b31576e249a3d2c13ec2c0cf8 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2020.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt new file mode 100644 index 00000000..94aa483d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt @@ -0,0 +1,4980 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: URP2021 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Opaque" "UniversalMaterialType" = "Lit" "Queue" = "Geometry" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _CLUSTERED_RENDERING + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + return color; + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt.meta new file mode 100644 index 00000000..21489559 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 69090a1deecc05842bc9e7d8d9f7ae6e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2021.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt new file mode 100644 index 00000000..ef23cad1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt @@ -0,0 +1,5007 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: URP2022 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Opaque" "UniversalMaterialType" = "Lit" "Queue" = "Geometry" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + #pragma multi_compile _ DOTS_INSTANCING_ON + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outColor : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + outColor = color; + + #ifdef _WRITE_RENDERING_LAYERS + #if UNITY_VERSION >= 60020000 + outRenderingLayers = EncodeMeshRenderingLayer(); + #else + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + #endif + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + +#if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); +#endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = TransformObjectToWorld(v.vertex.xyz); + o.worldNormal = TransformObjectToWorldNormal(v.normal); + o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + OUTPUT_SH(o.worldNormal, o.sh); + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + } + + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt.meta new file mode 100644 index 00000000..221a4399 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 7a76ffb960fb45246965a6e47eeb1a66 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2022.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt new file mode 100644 index 00000000..1c116954 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt @@ -0,0 +1,5258 @@ +//////////////////////////////////////// +// Generated with Better Shaders +// +// Auto-generated shader code, don't hand edit! +// +// Unity Version: 2021.3.45f2 +// Render Pipeline: URP2023 +// Platform: WindowsEditor +//////////////////////////////////////// + + +Shader "AllIn1SpriteShader/AllIn1SpriteShaderLit_BetterShader" +{ + Properties + { + + [NoScaleOffset] _MainTex ("Main Texture", 2D) = "white" {} //0 + _Color("Main Color", Color) = (1,1,1,1) //1 + _Alpha("General Alpha", Range(0,1)) = 1 //2 + + _GlowColor("Glow Color", Color) = (1,1,1,1) //3 + _Glow("Glow Color Intensity", Range(0,100)) = 10 //4 + _GlowGlobal("Global Glow Intensity", Range(1,100)) = 1 //5 + [NoScaleOffset] _GlowTex("Glow Texture", 2D) = "white" {} //6 + + [NoScaleOffset] _FadeTex("Fade Texture", 2D) = "white" {} //7 + _FadeAmount("Fade Amount", Range(-0.1,1)) = -0.1 //8 + _FadeBurnWidth("Fade Burn Width", Range(0,1)) = 0.025 //9 + _FadeBurnTransition("Burn Transition", Range(0.01,0.5)) = 0.075 //10 + _FadeBurnColor("Fade Burn Color", Color) = (1,1,0,1) //11 + _FadeBurnTex("Fade Burn Texture", 2D) = "white" {} //12 + _FadeBurnGlow("Fade Burn Glow", Range(1,250)) = 2//13 + + _OutlineColor("Outline Base Color", Color) = (1,1,1,1) //14 + _OutlineAlpha("Outline Base Alpha", Range(0,1)) = 1 //15 + _OutlineGlow("Outline Base Glow", Range(1,100)) = 1.5 //16 + _OutlineWidth("Outline Base Width", Range(0,0.2)) = 0.004 //17 + _OutlinePixelWidth("Outline Base Pixel Width", Int) = 1 //18 + + [Space] + _OutlineTex("Outline Texture", 2D) = "white" {} //19 + _OutlineTexXSpeed("Texture scroll speed X", Range(-50,50)) = 10 //20 + _OutlineTexYSpeed("Texture scroll speed Y", Range(-50,50)) = 0 //21 + + [Space] + [NoScaleOffset] _OutlineDistortTex("Outline Distortion Texture", 2D) = "white" {} //22 + _OutlineDistortAmount("Outline Distortion Amount", Range(0,2)) = 0.5 //23 + _OutlineDistortTexXSpeed("Distortion scroll speed X", Range(-50,50)) = 5 //24 + _OutlineDistortTexYSpeed("Distortion scroll speed Y", Range(-50,50)) = 5 //25 + + _AlphaOutlineColor("Color", Color) = (1, 1, 1, 1) //26 + _AlphaOutlineGlow("Outline Glow", Range(1,100)) = 5 //27 + _AlphaOutlinePower("Power", Range(0, 5)) = 1 // 28 + _AlphaOutlineMinAlpha("Min Alpha", Range(0, 1)) = 0 // 29 + _AlphaOutlineBlend("Blend", Range(0, 1)) = 1 // 30 + + _GradBlend("Gradient Blend", Range(0,1)) = 1 //31 + _GradTopLeftCol("Top Color", Color) = (1,0,0,1) //32 + _GradTopRightCol("Top Color 2", Color) = (1, 1, 0, 1) //33 + _GradBotLeftCol("Bot Color", Color) = (0,0,1,1) //34 + _GradBotRightCol("Bot Color 2", Color) = (0, 1, 0, 1) //35 + + [NoScaleOffset] _ColorSwapTex("Color Swap Texture", 2D) = "black" {} //36 + [HDR] _ColorSwapRed("Red Channel", Color) = (1,1,1,1) //37 + _ColorSwapRedLuminosity("Red luminosity", Range(-1,1)) = 0.5 //38 + [HDR] _ColorSwapGreen("Green Channel", Color) = (1,1,1,1) //39 + _ColorSwapGreenLuminosity("Green luminosity", Range(-1,1)) = 0.5 //40 + [HDR] _ColorSwapBlue("Blue Channel", Color) = (1,1,1,1) //41 + _ColorSwapBlueLuminosity("Blue luminosity", Range(-1,1)) = 0.5 //42 + + _HsvShift("Hue Shift", Range(0, 360)) = 180 //43 + _HsvSaturation("Saturation", Range(0, 2)) = 1 //44 + _HsvBright("Brightness", Range(0, 2)) = 1 //45 + + _HitEffectColor("Hit Effect Color", Color) = (1,1,1,1) //46 + _HitEffectGlow("Glow Intensity", Range(1,100)) = 5 //47 + [Space] + _HitEffectBlend("Hit Effect Blend", Range(0,1)) = 1 //48 + + _NegativeAmount("Negative Amount", Range(0, 1)) = 1 //49 + + _PixelateSize("Pixelate size", Range(4,512)) = 32 //50 + + [NoScaleOffset] _ColorRampTex("Color ramp Texture", 2D) = "white" {} //51 + _ColorRampLuminosity("Color ramp luminosity", Range(-1,1)) = 0 //52 + [Toggle()] _ColorRampOutline("Affects everything?", float) = 0 //53 + + _GreyscaleLuminosity("Greyscale luminosity", Range(-1,1)) = 0 //54 + [Toggle()] _GreyscaleOutline("Affects everything?", float) = 0 //55 + _GreyscaleTintColor("Greyscale Tint Color", Color) = (1,1,1,1) //56 + + _PosterizeNumColors("Number of Colors", Range(0,100)) = 8 //57 + _PosterizeGamma("Posterize Amount", Range(0.1,10)) = 0.75 //58 + [Toggle()] _PosterizeOutline("Affects everything?", float) = 0 //59 + + _BlurIntensity("Blur Intensity", Range(0,100)) = 10 //60 + [Toggle()] _BlurHD("Blur is Low Res?", float) = 0 //61 + + _MotionBlurAngle("Motion Blur Angle", Range(-1, 1)) = 0.1 //62 + _MotionBlurDist("Motion Blur Distance", Range(-3, 3)) = 1.25 //63 + + _GhostColorBoost("Ghost Color Boost", Range(0,5)) = 1 //64 + _GhostTransparency("Ghost Transparency", Range(0,1)) = 0 //65 + + _InnerOutlineColor("Inner Outline Color", Color) = (1,0,0,1) //66 + _InnerOutlineThickness("Outline Thickness", Range(0,3)) = 1 //67 + _InnerOutlineAlpha("Inner Outline Alpha", Range(0,1)) = 1 //68 + _InnerOutlineGlow("Inner Outline Glow", Range(1,250)) = 4 //69 + + _AlphaCutoffValue("Alpha cutoff value", Range(0, 1)) = 0.25 //70 + + [Toggle()] _OnlyOutline("Only render outline?", float) = 0 //71 + [Toggle()] _OnlyInnerOutline("Only render inner outline?", float) = 0 //72 + + _HologramStripesAmount("Stripes Amount", Range(0, 1)) = 0.1 //73 + _HologramUnmodAmount("Unchanged Amount", Range(0, 1)) = 0.0 //74 + _HologramStripesSpeed("Stripes Speed", Range(-20, 20)) = 4.5 //75 + _HologramMinAlpha("Min Alpha", Range(0, 1)) = 0.1 //76 + _HologramMaxAlpha("Max Alpha", Range(0, 100)) = 0.75 //77 + + _ChromAberrAmount("ChromAberr Amount", Range(0, 1)) = 1 //78 + _ChromAberrAlpha("ChromAberr Alpha", Range(0, 1)) = 0.4 //79 + + _GlitchAmount("Glitch Amount", Range(0, 20)) = 3 //80 + + _FlickerPercent("Flicker Percent", Range(0, 1)) = 0.05 //81 + _FlickerFreq("Flicker Frequency", Range(0, 5)) = 0.2 //82 + _FlickerAlpha("Flicker Alpha", Range(0, 1)) = 0 //83 + + _ShadowX("Shadow X Axis", Range(-0.5, 0.5)) = 0.1 //84 + _ShadowY("Shadow Y Axis", Range(-0.5, 0.5)) = -0.05 //85 + _ShadowAlpha("Shadow Alpha", Range(0, 1)) = 0.5 //86 + _ShadowColor("Shadow Color", Color) = (0, 0, 0, 1) //87 + + _HandDrawnAmount("Hand Drawn Amount", Range(0, 20)) = 10 //88 + _HandDrawnSpeed("Hand Drawn Speed", Range(1, 15)) = 5 //89 + + _GrassSpeed("Speed", Range(0,50)) = 2 //90 + _GrassWind("Bend amount", Range(0,50)) = 20 //91 + [Space] + [Toggle()] _GrassManualToggle("Manually animated?", float) = 0 //92 + _GrassManualAnim("Manual Anim Value", Range(-1,1)) = 1 //93 + + _WaveAmount("Wave Amount", Range(0, 25)) = 7 //94 + _WaveSpeed("Wave Speed", Range(0, 25)) = 10 //95 + _WaveStrength("Wave Strength", Range(0, 25)) = 7.5 //96 + _WaveX("Wave X Axis", Range(0, 1)) = 0 //97 + _WaveY("Wave Y Axis", Range(0, 1)) = 0.5 //98 + + _RectSize("Rect Size", Range(1, 4)) = 1 //99 + + _OffsetUvX("X axis", Range(-1, 1)) = 0 //100 + _OffsetUvY("Y axis", Range(-1, 1)) = 0 //101 + + _ClipUvLeft("Clipping Left", Range(0, 1)) = 0 //102 + _ClipUvRight("Clipping Right", Range(0, 1)) = 0 //103 + _ClipUvUp("Clipping Up", Range(0, 1)) = 0 //104 + _ClipUvDown("Clipping Down", Range(0, 1)) = 0 //105 + + _TextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 1 //106 + _TextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0 //107 + + _ZoomUvAmount("Zoom Amount", Range(0.1, 5)) = 0.5 //108 + + [NoScaleOffset] _DistortTex("Distortion Texture", 2D) = "white" {} //109 + _DistortAmount("Distortion Amount", Range(0,2)) = 0.5 //110 + _DistortTexXSpeed("Scroll speed X", Range(-50,50)) = 5 //111 + _DistortTexYSpeed("Scroll speed Y", Range(-50,50)) = 5 //112 + + _TwistUvAmount("Twist Amount", Range(0, 3.1416)) = 1 //113 + _TwistUvPosX("Twist Pos X Axis", Range(0, 1)) = 0.5 //114 + _TwistUvPosY("Twist Pos Y Axis", Range(0, 1)) = 0.5 //115 + _TwistUvRadius("Twist Radius", Range(0, 3)) = 0.75 //116 + + _RotateUvAmount("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //117 + + _FishEyeUvAmount("Fish Eye Amount", Range(0, 0.5)) = 0.35 //118 + + _PinchUvAmount("Pinch Amount", Range(0, 0.5)) = 0.35 //119 + + _ShakeUvSpeed("Shake Speed", Range(0, 20)) = 2.5 //120 + _ShakeUvX("X Multiplier", Range(0, 5)) = 1.5 //121 + _ShakeUvY("Y Multiplier", Range(0, 5)) = 1 //122 + + _ColorChangeTolerance("Tolerance", Range(0, 1)) = 0.25 //123 + _ColorChangeTarget("Color to change", Color) = (1, 0, 0, 1) //124 + [HDR] _ColorChangeNewCol("New Color", Color) = (1, 1, 0, 1) //125 + _ColorChangeLuminosity("New Color Luminosity", Range(0, 1)) = 0.0 //126 + + _RoundWaveStrength("Wave Strength", Range(0, 1)) = 0.7 //127 + _RoundWaveSpeed("Wave Speed", Range(0, 5)) = 2 //128 + + [Toggle()] _BillboardY("Billboard on both axis?", float) = 0 //129 + _ZWrite ("Depth Write", Float) = 1.0 // 130 + + _MySrcMode ("SrcMode", Float) = 5 // 131 + _MyDstMode ("DstMode", Float) = 10 // 132 + + _ShineColor("Shine Color", Color) = (1,1,1,1) // 133 + _ShineLocation("Shine Location", Range(0,1)) = 0.5 // 134 + _ShineRotate("Rotate Angle(radians)", Range(0, 6.2831)) = 0 //135 + _ShineWidth("Shine Width", Range(0.05,1)) = 0.1 // 136 + _ShineGlow("Shine Glow", Range(0,100)) = 1 // 137 + [NoScaleOffset] _ShineMask("Shine Mask", 2D) = "white" {} // 138 + + _GlitchSize("Glitch Size", Range(0.25, 5)) = 1 //139 + _HologramStripeColor("Stripes Color", Color) = (0,1,1,1) //140 + _GradBoostX("Boost X axis", Range(0.1, 5)) = 1.2 //141 + _GradBoostY("Boost Y axis", Range(0.1, 5)) = 1.2 //142 + [Toggle()] _GradIsRadial("Radial Gradient?", float) = 0 //143 + _AlphaRoundThreshold("Round Threshold", Range(0.005, 1.0)) = 0.5 //144 + _GrassRadialBend("Radial Bend", Range(0.0, 5.0)) = 0.1 //145 + + _ColorChangeTolerance2("Tolerance 2", Range(0, 1)) = 0.25 //146 + _ColorChangeTarget2("Color to change 2", Color) = (1, 0, 0, 1) //147 + [HDR] _ColorChangeNewCol2("New Color 2", Color) = (1, 1, 0, 1) //148 + _ColorChangeTolerance3("Tolerance 3", Range(0, 1)) = 0.25 //149 + _ColorChangeTarget3("Color to change 3", Color) = (1, 0, 0, 1) //150 + [HDR] _ColorChangeNewCol3("New Color 3", Color) = (1, 1, 0, 1) //151 + + _Contrast ("Contrast", Range(0, 6)) = 1 // 152 + _Brightness ("Brightness", Range(-1, 1)) = 0 // 153 + + _ColorSwapBlend ("Color Swap Blend", Range(0, 1)) = 1 // 154 + _ColorRampBlend ("Color Ramp Blend", Range(0, 1)) = 1 // 155 + _GreyscaleBlend ("Greyscale Blend", Range(0, 1)) = 1 // 156 + _GhostBlend ("Ghost Blend", Range(0, 1)) = 1 // 157 + _HologramBlend ("Hologram Blend", Range(0, 1)) = 1 // 158 + + [NoScaleOffset] [AllIn1ShaderGradient] _ColorRampTexGradient("Color ramp Gradient", 2D) = "white" {} //159 + + [NoScaleOffset] _OverlayTex("Overlay Texture", 2D) = "white" {} //160 + _OverlayColor("Overlay Color", Color) = (1, 1, 1, 1) //161 + _OverlayGlow("Overlay Glow", Range(0,25)) = 1 // 162 + _OverlayBlend("Overlay Blend", Range(0, 1)) = 1 // 163 + + _RadialStartAngle("Radial Start Angle", Range(0, 360)) = 90 //164 + _RadialClip("Radial Clip", Range(0, 360)) = 45 //165 + _RadialClip2("Radial Clip 2", Range(0, 360)) = 0 //166 + + _WarpStrength("Warp Strength", Range(0, 0.1)) = 0.025 //167 + _WarpSpeed("Warp Speed", Range(0, 25)) = 8 //168 + _WarpScale("Warp Scale", Range(0.05, 3)) = 0.5 //169 + + _OverlayTextureScrollXSpeed("Speed X Axis", Range(-5, 5)) = 0.25 //170 + _OverlayTextureScrollYSpeed("Speed Y Axis", Range(-5, 5)) = 0.25 //171 + + /**/ + _MainTex_ScaleAndTiling("Main Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //172 + _FadeTex_ScaleAndTiling("Fade Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //173 + _FadeBurnTex_ScaleAndTiling("Fade Burn Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //174 + _OutlineTex_ScaleAndTiling("Outline Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //175 + _OutlineDistortTex_ScaleAndTiling("Outline Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //176 + _DistortTex_ScaleAndTiling("Distort Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //177 + _OverlayTex_ScaleAndTiling("Overlay Tex - Scale and Tiling", Vector) = (1, 1, 0, 0) //178 + [HideInInspector]_SpriteFlip("_SpriteFlip", Vector) = (1, 1, 1, 1) //179 + /**/ + + _GlitchSpeed("Glitch Speed", Range(0.0, 100)) = 20 //180 + + _ZTestMode ("Z Test Mode", Float) = 4 //181 + _CullingOption ("Culling Option", float) = 0 //182 + + [HideInInspector] _MinXUV("_MinXUV", Range(0, 1)) = 0.0 //183 + [HideInInspector] _MaxXUV("_MaxXUV", Range(0, 1)) = 1.0 //184 + [HideInInspector] _MinYUV("_MinYUV", Range(0, 1)) = 0.0 //185 + [HideInInspector] _MaxYUV("_MaxYUV", Range(0, 1)) = 1.0 //186 + [HideInInspector] _RandomSeed("_MaxYUV", Range(0, 10000)) = 0.0 //187 + _EditorDrawers("Editor Drawers", Int) = 6 //188 + + [Normal][NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {} //189 + _NormalStrength("Normal Strength", Range(0, 15)) = 1.0 //190 + + + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + + } + SubShader + { + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Opaque" "UniversalMaterialType" = "Lit" "Queue" = "Geometry" } + + + + + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Blend [_MySrcMode] [_MyDstMode] + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW + #pragma multi_compile_fragment _ _SHADOWS_SOFT_MEDIUM + #pragma multi_compile_fragment _ _SHADOWS_SOFT_HIGH + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + //#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _ EVALUATE_SH_VERTEX + #pragma multi_compile _ EVALUATE_SH_MIXED + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + + // GraphKeywords: + + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outColor : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #elif defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2) + #if UNITY_VERSION >= 60000009 + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos, IN.probeOcclusion, inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos); + #endif + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + outColor = color; + + #ifdef _WRITE_RENDERING_LAYERS + #if UNITY_VERSION >= 60020000 + outRenderingLayers = EncodeMeshRenderingLayer(); + #else + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + #endif + + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local OUTBASE_ON + #pragma shader_feature_local ONLYOUTLINE_ON + #pragma shader_feature_local GRADIENT_ON + #pragma shader_feature_local GRADIENT2COL_ON + #pragma shader_feature_local RADIALGRADIENT_ON + #pragma shader_feature_local COLORSWAP_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local CHANGECOLOR_ON + #pragma shader_feature_local CHANGECOLOR2_ON + #pragma shader_feature_local CHANGECOLOR3_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local GRADIENTCOLORRAMP_ON + #pragma shader_feature_local HITEFFECT_ON + #pragma shader_feature_local NEGATIVE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local GREYSCALE_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local BLUR_ON + #pragma shader_feature_local MOTIONBLUR_ON + #pragma shader_feature_local GHOST_ON + #pragma shader_feature_local ALPHAOUTLINE_ON + #pragma shader_feature_local INNEROUTLINE_ON + #pragma shader_feature_local ONLYINNEROUTLINE_ON + #pragma shader_feature_local HOLOGRAM_ON + #pragma shader_feature_local CHROMABERR_ON + #pragma shader_feature_local GLITCH_ON + #pragma shader_feature_local FLICKER_ON + #pragma shader_feature_local SHADOW_ON + #pragma shader_feature_local SHINE_ON + #pragma shader_feature_local CONTRAST_ON + #pragma shader_feature_local OVERLAY_ON + #pragma shader_feature_local OVERLAYMULT_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local WIND_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local RECTSIZE_ON + #pragma shader_feature_local OFFSETUV_ON + #pragma shader_feature_local CLIPPING_ON + #pragma shader_feature_local RADIALCLIPPING_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local ZOOMUV_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local WARP_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local ROTATEUV_ON + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local FISHEYE_ON + #pragma shader_feature_local PINCH_ON + #pragma shader_feature_local SHAKEUV_ON + + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local OUTTEX_ON + #pragma shader_feature_local OUTDIST_ON + #pragma shader_feature_local OUTBASE8DIR_ON + #pragma shader_feature_local OUTBASEPIXELPERF_ON + #pragma shader_feature_local COLORRAMPOUTLINE_ON + #pragma shader_feature_local GREYSCALEOUTLINE_ON + #pragma shader_feature_local POSTERIZEOUTLINE_ON + #pragma shader_feature_local BLURISHD_ON + #pragma shader_feature_local MANUALWIND_ON + #pragma shader_feature_local ATLAS_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + + #pragma shader_feature BILBOARD_ON + #pragma shader_feature BILBOARDY_ON + + #pragma shader_feature NORMALMAP_ON + + + #define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw + #define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb + + + + + + #define _URP 1 +#define _USINGTEXCOORD1 1 +#define _USINGTEXCOORD2 1 +#define NEED_FACING 1 + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + float4 texcoord1 : TEXCOORD4; + float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + // float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + // float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + float4 _SpriteFlip; + + half4 _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha, _AlphaCutoffValue; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + half _HsvShift, _HsvSaturation, _HsvBright; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half4 _FadeBurnColor/*, _FadeTex_ST, _FadeBurnTex_ST*/; + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition,_FadeBurnGlow; + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + + half _ColorRampLuminosity, _ColorRampBlend; + + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + + half _NegativeAmount; + + + half _PixelateSize; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _Contrast, _Brightness; + + half4 /*_OverlayTex_ST,*/ _OverlayColor; + float4 _OverlayTex_ScaleAndTiling; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + + half _RoundWaveStrength, _RoundWaveSpeed; + + + half _RectSize; + + + half _OffsetUvX, _OffsetUvY; + + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half _ZoomUvAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + half _NormalStrength; + + float _RandomSeed; + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if GLOW_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if OUTTEX_ON + TEXTURE2D(_OutlineTex); + SAMPLER(sampler_OutlineTex); + #endif + + #if OUTDIST_ON + TEXTURE2D(_OutlineDistortTex); + SAMPLER(sampler_OutlineDistortTex); + #endif + + #if COLORSWAP_ON + TEXTURE2D(_ColorSwapTex); + SAMPLER(sampler_ColorSwapTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTex); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if SHINE_ON + TEXTURE2D(_ShineMask); + SAMPLER(sampler_ShineMask); + #endif + + #if OVERLAY_ON + TEXTURE2D(_OverlayTex); + SAMPLER(sampler_OverlayTex); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + //BLURS------------------------------------------------------------------------- + half4 Blur(half2 uv, Texture2D source, SamplerState sampler_source, half Intensity) + { + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, sampler_source, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, sampler_source, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; + } + + half BlurHD_G(half bhqp, half x) + { + return exp(-(x * x) / (2.0 * bhqp * bhqp)); + } + half4 BlurHD(half2 uv, Texture2D source, SamplerState sampler_source, half BlurAmount, half xScale, half yScale) + { + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, sampler_source, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; + } + //----------------------------------------------------------------------- + + + //------------------------------------------- + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + //------------------------------------------- + + //----------------------------------------------------------------------- + half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; + } + + half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; + } + //----------------------------------------------------------------------- + + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //BILBOARD_ON + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + float3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + v.vertex = float4(localPos, 1); + #else + float3 localPos = v.vertex.xyz; + v.vertex = float4(localPos, 1.0); + #endif + //----------------------------------------------------------- + + v.texcoord0.xy = v.texcoord0.xy * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + //POLARUV_ON + #if POLARUV_ON + v.texcoord0.xy = v.texcoord0.xy - center; + #endif + + //---------------------------------------- + + //ROTATEUV_ON + #if ROTATEUV_ON + half2 uvC = v.texcoord0.xy; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + v.texcoord0.xy = mul(rot, uvC); + v.texcoord0.xy += center; + #endif + //-------------------- + + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + #if OUTTEX_ON + v.texcoord1.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + v.texcoord2.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + v.texcoord3.xy = CUSTOM_TRANSFORM_TEX(v.texcoord0.xy, _DistortTex_ScaleAndTiling); + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + half randomSeed = _RandomSeed; + + float2 uvRect = d.texcoord0; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((d.texcoord0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + //CLIPPING_ON + #if CLIPPING_ON + half2 tiledUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + //---------------------------------- + + //RADIALCLIPPING_ON + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + //----------------------------- + + //TEXTURESCROLL_ON && ATLAS_ON + #if TEXTURESCROLL_ON && ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + //---------------------------- + + //OFFSETUV_ON + #if OFFSETUV_ON + #if ATLAS_ON + d.texcoord0.xy = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + d.texcoord0.xy += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + //---------------------- + + //POLARUV_ON + #if POLARUV_ON + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (2.0f * 3.141592653589f), length(d.texcoord0.xy)); + d.texcoord0.xy *= _MainTex_ScaleAndTiling.xy; + #endif + + //-------------------------------------- + + //TWISTUV_ON + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + d.texcoord0.xy = tempUv; + #endif + + //-------------------------------------------- + + //FISHEYE_ON + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = d.texcoord0.xy - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + d.texcoord0.xy = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + //--------------------------------------------- + + //PINCH_ON + #if PINCH_ON + half2 dP = d.texcoord0.xy - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + d.texcoord0.xy = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + //--------------------------------------------- + + //ZOOMUV_ON + #if ZOOMUV_ON + d.texcoord0.xy -= centerTiled; + d.texcoord0.xy = d.texcoord0.xy * _ZoomUvAmount; + d.texcoord0.xy += centerTiled; + #endif + + //----------------------------------------------- + + //DOODLE_ON + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + //-------------------------- + + //SHAKEUV_ON + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + //------------------------------------------- + + //RECTSIZE_ON + #if RECTSIZE_ON + d.texcoord0.xy = d.texcoord0.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + //------------------------------------------- + + //DISTORT_ON + #if DISTORT_ON + #if ATLAS_ON + d.texcoord3.x = d.texcoord3.x * (1 / (_MaxXUV - _MinXUV)); + d.texcoord3.y = d.texcoord3.y * (1 / (_MaxYUV - _MinYUV)); + #endif + + d.texcoord3.x += ((_Time.x + _RandomSeed) * _DistortTexXSpeed) % 1; + d.texcoord3.y += ((_Time.x + _RandomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, d.texcoord3.xy).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + //------------------------------------------------------- + + //WARP_ON + #if WARP_ON + half2 warpUv = half2(d.texcoord0.x / _MainTex_ScaleAndTiling.x, d.texcoord0.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + d.texcoord0.xy += warp; + #endif + + //------------------------------------------------------- + + //WAVEUV_ON + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - d.texcoord0.xy; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + d.texcoord0.xy = d.texcoord0.xy + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + //---------------------------------------------------- + + //ROUNDWAVEUV_ON + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + //---------------------------------------------------- + + + //WIND_ON + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + d.texcoord0.x = fmod(abs(lerp(d.texcoord0.x, d.texcoord0.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = d.texcoord0.xy - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + d.texcoord0.xy = d.texcoord0.xy + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + //-------------------------------------------------------- + + //TEXTURESCROLL_ON && !ATLAS_ON + #if TEXTURESCROLL_ON && !ATLAS_ON + d.texcoord0.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + d.texcoord0.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + //------------------------------ + + //PIXELATE_ON + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + //-------------- + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy); + half originalAlpha = col.a; + col *= d.vertexColor; + + //NORMAL MAP + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + + float3 lightDir; + float3 lightColor; + GetSun(lightDir, lightColor); + + + float flipNormalFactor = 1.0; + if(!d.isFrontFace){ + flipNormalFactor *= -1.0; + } + + flipNormalFactor *= _SpriteFlip.z; + o.Normal *= flipNormalFactor; + + //GLITCH_ON + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * d.vertexColor; + #endif + //-------------------------------------- + + //CHROMABERR_ON + #if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ChromAberrAmount/10, 0)) * d.vertexColor; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-_ChromAberrAmount/10, 0)) * d.vertexColor; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + //-------------------------------- + + //BLUR_ON + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * d.vertexColor; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * d.vertexColor; + #else + col = Blur(d.texcoord0.xy, _MainTex, sampler_MainTex, _BlurIntensity) * d.vertexColor; + #endif + #endif + #endif + + //-------------------- + + //MOTIONBLUR_ON + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + //------------------------------------ + + //NEGATIVE_ON + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + //-------------- + half luminance = 0; + + //GREYSCALE_ON && !GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + //------------------------------------ + + //GHOST_ON + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + //------------------------------------ + + //INNEROUTLINE_ON + #if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, d.texcoord0.xy, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, d.texcoord0.xy, _MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + //------------------------------------------------------- + + //HITEFFECT_ON + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + //-------------------- + + //GRADIENT_ON + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + //-------------------------------------------------------------------- + + //CONTRAST_ON + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + //------------------------------------------------------------------- + + //COLORSWAP_ON + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, d.texcoord0.xy); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + //-------------------------------------------------------------------- + + //COLORRAMP_ON && !COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //-------------------------------------------------------------------- + + //CHANGECOLOR_ON + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + //------------------------------------------------------- + + //POSTERIZE_ON && !POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + //------------------------------------ + + //HSV_ON + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + //------------------------------------------------------- + + //OVERLAY_ON + #if OVERLAY_ON + half2 overlayUvs = d.texcoord0.xy; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //--------------------------------- + + //OUTBASE_ON + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + d.texcoord2.x += ((_Time.x + _RandomSeed) * _OutlineDistortTexXSpeed) % 1; + d.texcoord2.y += ((_Time.x + _RandomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord2 = half2((d.texcoord2.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, d.texcoord2).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + d.texcoord1.x += ((_Time.x + _RandomSeed) * _OutlineTexXSpeed) % 1; + d.texcoord1.y += ((_Time.x + _RandomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + d.texcoord1 = half2((d.texcoord1.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.texcoord1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, d.texcoord1); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * d.vertexColor.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //------------------------------------------------------- + + //FADE_ON + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(d.texcoord0, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + //------------------------------------------------------- + + //SHADOW_ON + #if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, d.texcoord0.xy + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * d.vertexColor.a, col.a); + #endif + + //------------------------------------------------------- + + //GLOW_ON + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, d.texcoord0); + #else + emission = col; + #endif + + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + //------------------------------------------------------- + + //COLORRAMP_ON && COLORRAMPOUTLINE_ON + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + //--------------- + + //GREYSCALE_ON && GREYSCALEOUTLINE_ON + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + //----------------------------------- + + //POSTERIZE_ON && POSTERIZEOUTLINE_ON + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + //----------------------------------- + + //SHINE_ON + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, d.texcoord0.xy).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + //----------------------------------- + + //HOLOGRAM_ON + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + //----------------------------------- + + //FLICKER_ON + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + //----------------------------------- + + //ALPHACUTOFF_ON + + //ALPHAROUND_ON + + //ALPHAOUTLINE_ON + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + //------------------------------------------------------- + + //FOG_ON + + //------------------ + + col *= _Color; + + col.a *= _Alpha; + o.Albedo = col; + + clip(col.a - _AlphaCutoffValue - 0.01); + o.Alpha = col.a; + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + // v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(d.worldSpacePosition); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + #if _HDRP || _URP + d.worldSpaceViewDir = GetWorldSpaceNormalizeViewDir(i.worldPos); + #else + d.worldSpaceViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos)); + #endif + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + d.texcoord1 = i.texcoord1; + d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + d.texcoord3 = i.texcoord3; + // #endif + + d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + // d.screenPos = i.screenPos; + // d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + // d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + // d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + // d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + // d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + o.texcoord1 = v.texcoord1; + o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + // o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + + } + + + CustomEditor "AllIn1SpriteShader.AllIn1SpriteShaderLitMaterialInspector" +} diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt.meta new file mode 100644 index 00000000..ab0bf6c0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a84fbc897c8eaaf40b7075fd17cdbb7f +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/AllIn1SpriteShaderLit_BetterShader_URP2023.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/README.txt b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/README.txt new file mode 100644 index 00000000..612a832a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/README.txt @@ -0,0 +1,31 @@ +# BetterShaders_AllIn1Sprite Shader + +This shader was created using Better Shaders, a Unity asset by Jason Booth that simplifies cross-pipeline shader development. + +## Usage +- If you own Better Shaders: You can modify the shader's source code: AllIn1SpriteShaderLit_BetterShader.surfshader +- If you don't own Better Shaders: A pre-compiled version matching your current Render Pipeline and Unity version will be automatically set up. + +## Why Better Shaders? +Better Shaders was used because Unity doesn't have an easy way to create hand written lit shaders compatible across all render pipelines. + +## About Better Shaders +Better Shaders streamlines shader creation by: +- Enabling Unity-like shader writing +- Auto-compiling for various pipelines +- Allowing shader stacking +- Functioning like native Unity shaders + +For more information or to purchase Better Shaders, visit: +[Better Shaders on Unity Asset Store](https://assetstore.unity.com/packages/tools/visual-scripting/better-shaders-2022-standard-urp-hdrp-244057) + +## What are all the .txt shaders and how to export them? +The .txt shaders are the pipeline-specific source code for the shader. You can export them by: +1. Selecting AllIn1SpriteShaderLit_BetterShader.surfshader +2. Export all shaders as text assets + +Doing this will cause some URP and HDRP shaders material inspectors properties to be in the incorrect order. To fix this, you can: +1. Localize the Better Shaders2022 folder +2. Inside you'll see the PipelineTemplates folder +3. There, find your pipeline's template +4. Make sure that "%PROPERTIES%" is right under "Properties{" diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/README.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/README.txt.meta new file mode 100644 index 00000000..38164e11 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/README.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 4026e642526007b45b74a1f1064e6ba2 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/LitShaders/README.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary.meta new file mode 100644 index 00000000..c7ac1dca --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a8c7136836fcfb3448e5f1822a7192d9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer.meta new file mode 100644 index 00000000..4733f79c --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 786a2bacb5f53844392f7846e0ff411c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_CommonFunctions.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_CommonFunctions.hlsl new file mode 100644 index 00000000..c7c16d9e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_CommonFunctions.hlsl @@ -0,0 +1,87 @@ +#ifndef ALLIN1SPRITESHADER_2DRENDERER_COMMONFUNCTIONS +#define ALLIN1SPRITESHADER_2DRENDERER_COMMONFUNCTIONS + +//Prevent Unity warnings that are not relevant for this shader------------------- +#pragma warning (disable : 3571) // pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them +#pragma warning (disable : 4008) // floating point division by zero +#pragma warning (disable : 3206) // implicit truncation of vector type +//BLURS------------------------------------------------------------------------- + + +#define ALLIN1_SAMPLE_TEXTURE_2D(texName, uv) SAMPLE_TEXTURE2D(texName, sampler##texName, uv) + +half4 Blur(half2 uv, Texture2D source, SamplerState texSampler, half Intensity) +{ + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, texSampler, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, texSampler, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; +} + +half BlurHD_G(half bhqp, half x) +{ + return exp(-(x * x) / (2.0 * bhqp * bhqp)); +} +half4 BlurHD(half2 uv, Texture2D source, SamplerState texSampler, half BlurAmount, half xScale, half yScale) +{ + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, texSampler, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; +} +//----------------------------------------------------------------------- +half rand(half offset, half2 seed) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; +} + +half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; +} + +half rand2CustomTime(half offset, half2 seed, half customTime, half speed) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; +} +//----------------------------------------------------------------------- +half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); +} + +half3 GetPixel(in int offsetX, in int offsetY, half2 uv, Texture2D tex, SamplerState texSampler, float4 texelSize) +{ + half2 correctedUV = (uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)); + half3 res = SAMPLE_TEXTURE2D(tex, texSampler, correctedUV).rgb; + return res; +} + +#endif //ALLIN1SPRITESHADER_2DRENDERER_COMMONFUNCTIONS \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_CommonFunctions.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_CommonFunctions.hlsl.meta new file mode 100644 index 00000000..f8307cd9 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_CommonFunctions.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: b271c3be2c8bda1448755707cbb814cd +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_CommonFunctions.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_FragmentPass.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_FragmentPass.hlsl new file mode 100644 index 00000000..7c92bd52 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_FragmentPass.hlsl @@ -0,0 +1,588 @@ +#ifndef ALLIN1SPRITESHADER_2DRENDERER_FRAGMENTPASS +#define ALLIN1SPRITESHADER_2DRENDERER_FRAGMENTPASS + +half4 CombinedShapeLightFragment(v2f i) : SV_Target +{ + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + half randomSeed = _RandomSeed; + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + float2 uvRect = i.uv; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((i.uv.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + #if CLIPPING_ON + half2 tiledUv = half2(i.uv.x / _MainTex_ScaleAndTiling.x, i.uv.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(i.uv.x / _MainTex_ScaleAndTiling.x, i.uv.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + #if TEXTURESCROLL_ON && ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + + #if OFFSETUV_ON + #if ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + i.uv += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + #if POLARUV_ON + i.uv = half2(atan2(i.uv.y, i.uv.x) / (2.0f * 3.141592653589f), length(i.uv)); + i.uv *= _MainTex_ScaleAndTiling.xy; + #endif + + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = i.uv - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + i.uv = tempUv; + #endif + + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = i.uv - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + i.uv = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + + #if PINCH_ON + half2 dP = i.uv - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + i.uv = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + #if ZOOMUV_ON + i.uv -= centerTiled; + i.uv = i.uv * _ZoomUvAmount; + i.uv += centerTiled; + #endif + + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + i.uv = lerp(i.uv, i.uv + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + i.uv += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if RECTSIZE_ON + i.uv = i.uv.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + #if DISTORT_ON + #if ATLAS_ON + i.uvDistTex.x = i.uvDistTex.x * (1 / (_MaxXUV - _MinXUV)); + i.uvDistTex.y = i.uvDistTex.y * (1 / (_MaxYUV - _MinYUV)); + #endif + i.uvDistTex.x += ((_Time.x + randomSeed) * _DistortTexXSpeed) % 1; + i.uvDistTex.y += ((_Time.x + randomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (ALLIN1_SAMPLE_TEXTURE_2D(_DistortTex, i.uvDistTex).r - 0.5) * 0.2 * _DistortAmount; + i.uv.x += distortAmnt; + i.uv.y += distortAmnt; + #endif + + #if WARP_ON + half2 warpUv = half2(i.uv.x / _MainTex_ScaleAndTiling.x, i.uv.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + i.uv += warp; + #endif + + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - i.uv; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + i.uv = i.uv + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + i.uv += sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0); + #endif + + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = i.uv - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + i.uv = i.uv + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + #if TEXTURESCROLL_ON && !ATLAS_ON + i.uv.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + i.uv.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + i.uv = floor(i.uv * pixelSize) / pixelSize; + #endif + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); + half originalAlpha = col.a; + col *= i.color; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * i.color; + #endif + + #if CHROMABERR_ON + half4 r = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(_ChromAberrAmount/10, 0)) * i.color; + half4 b = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(-_ChromAberrAmount/10, 0)) * i.color; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * i.color; + #else + col = Blur(i.uv, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * i.color; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * i.color; + #else + col = Blur(i.uv, _MainTex, sampler_MainTex, _BlurIntensity) * i.color; + #endif + #endif + #endif + + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + #if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); + #endif + col.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; + #endif + + #if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); + #endif + + half luminance = 0; + #if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + + #if INNEROUTLINE_ON + half3 innerT = abs(GetPixel(0, _InnerOutlineThickness, i.uv, _MainTex, sampler_MainTex, texelSize) - GetPixel(0, -_InnerOutlineThickness, i.uv, _MainTex, sampler_MainTex, texelSize)); + innerT += abs(GetPixel(_InnerOutlineThickness, 0, i.uv, _MainTex, sampler_MainTex, texelSize) - GetPixel(-_InnerOutlineThickness, 0, i.uv, _MainTex, sampler_MainTex, texelSize)); + #if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + #else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); + #endif + #endif + + #if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); + #endif + + #if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); + #if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; + #endif + #if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); + #else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); + #endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; + #endif + + #if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; + #endif + + #if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = ALLIN1_SAMPLE_TEXTURE_2D(_ColorSwapTex, i.uv); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * col.a * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * col.a * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * col.a * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); + #endif + + #if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, ALLIN1_SAMPLE_TEXTURE_2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, ALLIN1_SAMPLE_TEXTURE_2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); + #if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); + #endif + #if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); + #endif + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if OVERLAY_ON + half2 overlayUvs = i.uv; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = ALLIN1_SAMPLE_TEXTURE_2D(_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //OUTLINE------------------------------------------------------------- + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + i.uvOutDistTex.x += ((_Time.x + randomSeed) * _OutlineDistortTexXSpeed) % 1; + i.uvOutDistTex.y += ((_Time.x + randomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutDistTex = half2((i.uvOutDistTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutDistTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (ALLIN1_SAMPLE_TEXTURE_2D(_OutlineDistortTex, i.uvOutDistTex).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(destUv.x, 0)).a; + half spriteRight = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv - half2(destUv.x, 0)).a; + half spriteBottom = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(0, destUv.y)).a; + half spriteTop = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(destUv.x, destUv.y)).a; + half spriteTopRight = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + i.uvOutTex.x += ((_Time.x + randomSeed) * _OutlineTexXSpeed) % 1; + i.uvOutTex.y += ((_Time.x + randomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutTex = half2((i.uvOutTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = ALLIN1_SAMPLE_TEXTURE_2D(_OutlineTex, i.uvOutTex); + #if OUTGREYTEXTURE_ON + luminance = 0.3 * tempOutColor.r + 0.59 * tempOutColor.g + 0.11 * tempOutColor.b; + tempOutColor = half4(luminance, luminance, luminance, 1); + #endif + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * i.color.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //----------------------------------------------------------------------------- + + #if FADE_ON + half2 tiledUvFade1= CUSTOM_TRANSFORM_TEX(i.uv, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(i.uv, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = ALLIN1_SAMPLE_TEXTURE_2D(_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * ALLIN1_SAMPLE_TEXTURE_2D(_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + + #if SHADOW_ON + half shadowA = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * i.color.a, col.a); + #endif + + #if GLOW_ON + half4 emission; + #if GLOWTEX_ON + emission = ALLIN1_SAMPLE_TEXTURE_2D(_GlowTex, i.uv); + #else + emission = col; + #endif + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; + #endif + + #if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); + #if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, ALLIN1_SAMPLE_TEXTURE_2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); + #else + col.rgb = lerp(col.rgb, ALLIN1_SAMPLE_TEXTURE_2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); + #endif + #endif + + #if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); + #endif + + #if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); + #endif + + #if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = ALLIN1_SAMPLE_TEXTURE_2D(_ShineMask, i.uv).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; + #endif + + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + + col.a *= _Alpha; + + #if ALPHACUTOFF_ON + clip((1 - _AlphaCutoffValue) - (1 - col.a) - 0.01); + #endif + + #if ALPHAROUND_ON + col.a = step(_AlphaRoundThreshold, col.a); + #endif + + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + + col *= _Color; + originalAlpha = col.a; + + half4 mask = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, i.uv); + mask.rgb *= _LitAmount; + mask = saturate(mask); + SurfaceData2D surfaceData; + InputData2D inputData; + surfaceData.albedo = col.rgb; + surfaceData.alpha = col.a; + surfaceData.mask = mask; + inputData.uv = i.uv; + inputData.lightingUV = i.lightingUV; + half3 lightResult = CombinedShapeLightShared(surfaceData, inputData).rgb; + + #if GLOWLIGHT_ON + mask.rgb += mask.rgb; + mask.rgb -= col.rgb; + mask.rgb = saturate(mask.rgb); + col.rgb = lerp(col.rgb, lightResult, mask.rgb); + #else + col.rgb = lightResult; + #endif + + return col; +} + +#endif //ALLIN1SPRITESHADER_2DRENDERER_FRAGMENTPASS \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_FragmentPass.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_FragmentPass.hlsl.meta new file mode 100644 index 00000000..bcc4cbca --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_FragmentPass.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 20a889619f1033c4497fa398bd65d8a4 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_FragmentPass.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingFragmentPass.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingFragmentPass.hlsl new file mode 100644 index 00000000..f73e1560 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingFragmentPass.hlsl @@ -0,0 +1,405 @@ +#ifndef ALLIN1SPRITESHADER_2DRENDERER_NORMALSRENDERINGFRAGMENTPASS +#define ALLIN1SPRITESHADER_2DRENDERER_NORMALSRENDERINGFRAGMENTPASS + +float4 NormalsRenderingFragment(FragmentDataNormalsPass i) : SV_Target +{ + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + half randomSeed = UNITY_ACCESS_INSTANCED_PROP(Props, _RandomSeed); + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + float2 uvRect = i.uv; + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((i.uv.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + + #if CLIPPING_ON + half2 tiledUv = half2(i.uv.x / _MainTex_ScaleAndTiling.x, i.uv.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); + #endif + + #if RADIALCLIPPING_ON + half2 tiledUv2 = half2(i.uv.x / _MainTex_ScaleAndTiling.x, i.uv.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; + #endif + + #if TEXTURESCROLL_ON && ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); + #endif + + #if OFFSETUV_ON + #if ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); + #else + i.uv += half2(_OffsetUvX, _OffsetUvY); + #endif + #endif + + #if POLARUV_ON + i.uv = half2(atan2(i.uv.y, i.uv.x) / (2.0f * 3.141592653589f), length(i.uv)); + i.uv *= _MainTex_ScaleAndTiling.xy; + #endif + + #if TWISTUV_ON + #if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; + #endif + half2 tempUv = i.uv - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + i.uv = tempUv; + #endif + + #if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = i.uv - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + i.uv = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); + #endif + + #if PINCH_ON + half2 dP = i.uv - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + i.uv = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); + #endif + + #if ZOOMUV_ON + i.uv -= centerTiled; + i.uv = i.uv * _ZoomUvAmount; + i.uv += centerTiled; + #endif + + #if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + i.uv = lerp(i.uv, i.uv + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + i.uv += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if RECTSIZE_ON + i.uv = i.uv.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; + #endif + + #if DISTORT_ON + #if ATLAS_ON + i.uvDistTex.x = i.uvDistTex.x * (1 / (_MaxXUV - _MinXUV)); + i.uvDistTex.y = i.uvDistTex.y * (1 / (_MaxYUV - _MinYUV)); + #endif + i.uvDistTex.x += ((_Time.x + randomSeed) * _DistortTexXSpeed) % 1; + i.uvDistTex.y += ((_Time.x + randomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (ALLIN1_SAMPLE_TEXTURE_2D(_DistortTex, i.uvDistTex).r - 0.5) * 0.2 * _DistortAmount; + i.uv.x += distortAmnt; + i.uv.y += distortAmnt; + #endif + + #if WARP_ON + half2 warpUv = half2(i.uv.x / _MainTex_ScaleAndTiling.x, i.uv.y / _MainTex_ScaleAndTiling.y); + #if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + i.uv += warp; + #endif + + #if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - i.uv; + uvWave %= 1; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + i.uv = i.uv + uvWave * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + i.uv += sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0); + #endif + + #if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); + #if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; + #endif + #if !MANUALWIND_ON + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); + #else + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; + #endif + half2 delta = i.uv - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + i.uv = i.uv + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; + #endif + + #if TEXTURESCROLL_ON && !ATLAS_ON + i.uv.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + i.uv.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; + #endif + + #if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + i.uv = floor(i.uv * pixelSize) / pixelSize; + #endif + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); + half originalAlpha = col.a; + col *= i.color; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * i.color; + #endif + + #if CHROMABERR_ON + half4 r = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(_ChromAberrAmount/10, 0)) * i.color; + half4 b = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(-_ChromAberrAmount/10, 0)) * i.color; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); + #endif + + #if BLUR_ON + #if ATLAS_ON + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * i.color; + #else + col = Blur(i.uv, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * i.color; + #endif + #else + #if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * i.color; + #else + col = Blur(i.uv, _MainTex, sampler_MainTex, _BlurIntensity) * i.color; + #endif + #endif + #endif + + half luminance = 0; + #if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); + #endif + + #if OVERLAY_ON + half2 overlayUvs = i.uv; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = ALLIN1_SAMPLE_TEXTURE_2D(_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; + #if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; + #else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); + #endif + #endif + + //OUTLINE------------------------------------------------------------- + #if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + i.uvOutDistTex.x += ((_Time.x + randomSeed) * _OutlineDistortTexXSpeed) % 1; + i.uvOutDistTex.y += ((_Time.x + randomSeed) * _OutlineDistortTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutDistTex = half2((i.uvOutDistTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutDistTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half outDistortAmnt = (ALLIN1_SAMPLE_TEXTURE_2D(_OutlineDistortTex, i.uvOutDistTex).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(destUv.x, 0)).a; + half spriteRight = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv - half2(destUv.x, 0)).a; + half spriteBottom = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(0, destUv.y)).a; + half spriteTop = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv - half2(0, destUv.y)).a; + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(destUv.x, destUv.y)).a; + half spriteTopRight = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = ALLIN1_SAMPLE_TEXTURE_2D(_MainTex, i.uv + half2(-destUv.x, -destUv.y)).a; + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + i.uvOutTex.x += ((_Time.x + randomSeed) * _OutlineTexXSpeed) % 1; + i.uvOutTex.y += ((_Time.x + randomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutTex = half2((i.uvOutTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = ALLIN1_SAMPLE_TEXTURE_2D(_OutlineTex, i.uvOutTex); + #if OUTGREYTEXTURE_ON + luminance = 0.3 * tempOutColor.r + 0.59 * tempOutColor.g + 0.11 * tempOutColor.b; + tempOutColor = half4(luminance, luminance, luminance, 1); + #endif + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * i.color.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif + #endif + //----------------------------------------------------------------------------- + + #if FADE_ON + half2 tiledUvFade1 = CUSTOM_TRANSFORM_TEX(i.uv, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(i.uv, _FadeBurnTex_ScaleAndTiling); + #if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half fadeTemp = ALLIN1_SAMPLE_TEXTURE_2D(_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * ALLIN1_SAMPLE_TEXTURE_2D(_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); + #endif + + #if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); + #endif + + #if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); + #endif + + col.a *= _Alpha; + + #if ALPHACUTOFF_ON + clip((1 - _AlphaCutoffValue) - (1 - col.a) - 0.01); + #endif + + #if ALPHAROUND_ON + col.a = step(_AlphaRoundThreshold, col.a); + #endif + + #if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); + #endif + + col *= _Color; + originalAlpha = col.a; + + half4 normalSample = ALLIN1_SAMPLE_TEXTURE_2D(_NormalMap, i.uv); + + #if BLUR_ON + #if !BLURISHD_ON + normalSample = BlurHD(i.uv, _NormalMap, sampler_NormalMap, _BlurIntensity, 1, 1); + #else + normalSample = Blur(i.uv, _NormalMap, sampler_NormalMap, _BlurIntensity); + #endif + #endif + + #if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; + #define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; + normalSample.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_NormalMap, i.uv + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + normalSample.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_NormalMap, i.uv + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + normalSample.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_NormalMap, i.uv + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + normalSample.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_NormalMap, i.uv + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + normalSample.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_NormalMap, i.uv + rot(half2(_MotionBlurDist, _MotionBlurDist))); + normalSample.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_NormalMap, i.uv + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + normalSample.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_NormalMap, i.uv + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + normalSample.rgb += ALLIN1_SAMPLE_TEXTURE_2D(_NormalMap, i.uv + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + normalSample.rgb = normalSample.rgb / 9; + #endif + + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + + return NormalsRenderingShared(col, normalTS, i.tangentWS.xyz, i.bitangentWS.xyz, i.normalWS.xyz); +} + +#endif //ALLIN1SPRITESHADER_2DRENDERER_NORMALSRENDERINGFRAGMENTPASS \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingFragmentPass.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingFragmentPass.hlsl.meta new file mode 100644 index 00000000..a9896288 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingFragmentPass.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: b4b37519e6c679e49b918bbb9e1ee73a +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingFragmentPass.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingVertexPass.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingVertexPass.hlsl new file mode 100644 index 00000000..e323cbee --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingVertexPass.hlsl @@ -0,0 +1,68 @@ +#ifndef ALLIN1SPRITESHADER_2DRENDERER_NORMALSRENDERINGVERTEXPASS +#define ALLIN1SPRITESHADER_2DRENDERER_NORMALSRENDERINGVERTEXPASS + +FragmentDataNormalsPass NormalsRenderingVertex(VertexDataNormalsPass v) +{ + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + FragmentDataNormalsPass o; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + o.vertex = TransformObjectToHClip(localPos); + #else + o.vertex = TransformObjectToHClip(v.vertex.xyz); + #endif + o.uv = /*TRANSFORM_TEX(v.uv, _MainTex);*/v.uv * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + o.color = v.color; + + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + #if POLARUV_ON + o.uv = v.uv - center; + #endif + + #if ROTATEUV_ON + half2 uvC = v.uv; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + o.uv = mul(rot, uvC); + o.uv += center; + #endif + + #if OUTTEX_ON + o.uvOutTex = CUSTOM_TRANSFORM_TEX(v.uv, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + o.uvOutDistTex = CUSTOM_TRANSFORM_TEX(v.uv, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + o.uvDistTex = CUSTOM_TRANSFORM_TEX(v.uv, _DistortTex_ScaleAndTiling); + #endif + + o.normalWS = -GetViewForwardDir(); + o.tangentWS = TransformObjectToWorldDir(v.tangent.xyz); + o.bitangentWS = cross(o.normalWS, o.tangentWS) * v.tangent.w; + + return o; +} + +#endif //ALLIN1SPRITESHADER_2DRENDERER_NORMALSRENDERINGVERTEXPASS \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingVertexPass.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingVertexPass.hlsl.meta new file mode 100644 index 00000000..312658cc --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingVertexPass.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: dd224f68ca07bc8428b37ddc8044f25b +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_NormalsRenderingVertexPass.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Properties.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Properties.hlsl new file mode 100644 index 00000000..0e21a362 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Properties.hlsl @@ -0,0 +1,197 @@ +#ifndef ALLIN1SPRITESHADER_2DRENDERER_PROPERTIES +#define ALLIN1SPRITESHADER_2DRENDERER_PROPERTIES + +CBUFFER_START(UnityPerMaterial) + half4 /*_MainTex_ST, _MainTex_TexelSize,*/ _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha; + half _LitAmount; + half _NormalStrength; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half _RectSize; + + half _OffsetUvX, _OffsetUvY; + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + half _RoundWaveStrength, _RoundWaveSpeed; + + half _ZoomUvAmount; + + half4 _FadeBurnColor; /*_FadeTex_ST,*/ /*_FadeBurnTex_ST*/ + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition, _FadeBurnGlow; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half _HsvShift, _HsvSaturation, _HsvBright; + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + half _PixelateSize; + + half _NegativeAmount; + + half _ColorRampLuminosity, _ColorRampBlend; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _AlphaCutoffValue; + + half _AlphaRoundThreshold; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + half _Contrast, _Brightness; + + //half4 _OverlayTex_ST; + float4 _OverlayTex_ScaleAndTiling; + float4 _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + float _RandomSeed; +CBUFFER_END + + +#define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw +#define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb +#define DECLARE_TEX_AND_SAMPLER(texName) \ + TEXTURE2D(texName);\ + SAMPLER(sampler##texName); + + +DECLARE_TEX_AND_SAMPLER(_MainTex) +DECLARE_TEX_AND_SAMPLER(_MaskTex) +DECLARE_TEX_AND_SAMPLER(_NormalMap) + +#if FADE_ON + DECLARE_TEX_AND_SAMPLER(_FadeTex) + DECLARE_TEX_AND_SAMPLER(_FadeBurnTex) +#endif + +#if GLOW_ON + DECLARE_TEX_AND_SAMPLER(_GlowTex) + //sampler2D _GlowTex; +#endif + +#if OUTTEX_ON + DECLARE_TEX_AND_SAMPLER(_OutlineTex) +#endif + +#if OUTDIST_ON + DECLARE_TEX_AND_SAMPLER(_OutlineDistortTex) + //sampler2D _OutlineDistortTex; +#endif + +#if DISTORT_ON + DECLARE_TEX_AND_SAMPLER(_DistortTex) + //sampler2D _DistortTex; +#endif + +#if COLORSWAP_ON + DECLARE_TEX_AND_SAMPLER(_ColorSwapTex) +#endif + +#if COLORRAMP_ON + DECLARE_TEX_AND_SAMPLER(_ColorRampTex) + DECLARE_TEX_AND_SAMPLER(_ColorRampTexGradient) +#endif + +#if SHINE_ON + DECLARE_TEX_AND_SAMPLER(_ShineMask) +#endif + +#if OVERLAY_ON + DECLARE_TEX_AND_SAMPLER(_OverlayTex) +#endif + + + +#endif //ALLIN1SPRITESHADER_2DRENDERER_PROPERTIES \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Properties.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Properties.hlsl.meta new file mode 100644 index 00000000..0a7a883a --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Properties.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 2f5083985f9a1da43a7ce65b4add999a +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Properties.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_ShaderFeatures.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_ShaderFeatures.hlsl new file mode 100644 index 00000000..d22aefb8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_ShaderFeatures.hlsl @@ -0,0 +1,76 @@ +#ifndef ALLIN1SPRITESHADER_2DRENDERER_SHADERFEATURES +#define ALLIN1SPRITESHADER_2DRENDERER_SHADERFEATURES + +#pragma shader_feature_local GLOWLIGHT_ON +#pragma shader_feature_local GLOW_ON +#pragma shader_feature_local FADE_ON +#pragma shader_feature_local OUTBASE_ON +#pragma shader_feature_local ONLYOUTLINE_ON +#pragma shader_feature_local GRADIENT_ON +#pragma shader_feature_local GRADIENT2COL_ON +#pragma shader_feature_local RADIALGRADIENT_ON +#pragma shader_feature_local COLORSWAP_ON +#pragma shader_feature_local HSV_ON +#pragma shader_feature_local CHANGECOLOR_ON +#pragma shader_feature_local CHANGECOLOR2_ON +#pragma shader_feature_local CHANGECOLOR3_ON +#pragma shader_feature_local COLORRAMP_ON +#pragma shader_feature_local GRADIENTCOLORRAMP_ON +#pragma shader_feature_local HITEFFECT_ON +#pragma shader_feature_local NEGATIVE_ON +#pragma shader_feature_local PIXELATE_ON +#pragma shader_feature_local GREYSCALE_ON +#pragma shader_feature_local POSTERIZE_ON +#pragma shader_feature_local BLUR_ON +#pragma shader_feature_local MOTIONBLUR_ON +#pragma shader_feature_local GHOST_ON +#pragma shader_feature_local ALPHAOUTLINE_ON +#pragma shader_feature_local INNEROUTLINE_ON +#pragma shader_feature_local ONLYINNEROUTLINE_ON +#pragma shader_feature_local HOLOGRAM_ON +#pragma shader_feature_local CHROMABERR_ON +#pragma shader_feature_local GLITCH_ON +#pragma shader_feature_local FLICKER_ON +#pragma shader_feature_local SHADOW_ON +#pragma shader_feature_local SHINE_ON +#pragma shader_feature_local CONTRAST_ON +#pragma shader_feature_local OVERLAY_ON +#pragma shader_feature_local OVERLAYMULT_ON +#pragma shader_feature_local ALPHACUTOFF_ON +#pragma shader_feature_local ALPHAROUND_ON +#pragma shader_feature_local DOODLE_ON +#pragma shader_feature_local WIND_ON +#pragma shader_feature_local WAVEUV_ON +#pragma shader_feature_local ROUNDWAVEUV_ON +#pragma shader_feature_local RECTSIZE_ON +#pragma shader_feature_local OFFSETUV_ON +#pragma shader_feature_local CLIPPING_ON +#pragma shader_feature_local RADIALCLIPPING_ON +#pragma shader_feature_local TEXTURESCROLL_ON +#pragma shader_feature_local ZOOMUV_ON +#pragma shader_feature_local DISTORT_ON +#pragma shader_feature_local WARP_ON +#pragma shader_feature_local TWISTUV_ON +#pragma shader_feature_local ROTATEUV_ON +#pragma shader_feature_local POLARUV_ON +#pragma shader_feature_local FISHEYE_ON +#pragma shader_feature_local PINCH_ON +#pragma shader_feature_local SHAKEUV_ON + +#pragma shader_feature_local GLOWTEX_ON +#pragma shader_feature_local OUTTEX_ON +#pragma shader_feature_local OUTDIST_ON +#pragma shader_feature_local OUTBASE8DIR_ON +#pragma shader_feature_local OUTBASEPIXELPERF_ON +#pragma shader_feature_local COLORRAMPOUTLINE_ON +#pragma shader_feature_local GREYSCALEOUTLINE_ON +#pragma shader_feature_local POSTERIZEOUTLINE_ON +#pragma shader_feature_local BLURISHD_ON +#pragma shader_feature_local MANUALWIND_ON +#pragma shader_feature_local ATLAS_ON +#pragma shader_feature_local PREMULTIPLYALPHA_ON + +#pragma shader_feature_local BILBOARD_ON +#pragma shader_feature_local BILBOARDY_ON + +#endif //ALLIN1SPRITESHADER_2DRENDERER_SHADERFEATURES \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_ShaderFeatures.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_ShaderFeatures.hlsl.meta new file mode 100644 index 00000000..0a83ddcd --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_ShaderFeatures.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: fa43e9272d7e9da4895de72a2c8e0331 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_ShaderFeatures.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Structs.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Structs.hlsl new file mode 100644 index 00000000..653e9365 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Structs.hlsl @@ -0,0 +1,63 @@ +#ifndef ALLIN1SPRITESHADER_2DRENDERER_STRUCTS +#define ALLIN1SPRITESHADER_2DRENDERER_STRUCTS + +struct Attributes +{ + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + half4 color : COLOR; + + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct v2f +{ + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + half4 color : COLOR; + float2 lightingUV : TEXCOORD1; + #if OUTTEX_ON + half2 uvOutTex : TEXCOORD2; + #endif + #if OUTDIST_ON + half2 uvOutDistTex : TEXCOORD3; + #endif + #if DISTORT_ON + half2 uvDistTex : TEXCOORD4; + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + +struct VertexDataNormalsPass +{ + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + half4 color : COLOR; + half4 tangent : TANGENT; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct FragmentDataNormalsPass +{ + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + half4 color : COLOR; + half3 normalWS : TEXCOORD1; + half3 tangentWS : TEXCOORD2; + half3 bitangentWS : TEXCOORD3; + #if OUTTEX_ON + half2 uvOutTex : TEXCOORD4; + #endif + #if OUTDIST_ON + half2 uvOutDistTex : TEXCOORD5; + #endif + #if DISTORT_ON + half2 uvDistTex : TEXCOORD6; + #endif + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + + +#endif //ALLIN1SPRITESHADER_2DRENDERER_STRUCTS \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Structs.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Structs.hlsl.meta new file mode 100644 index 00000000..b62ed267 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Structs.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 588186a477d7f5a469575ff210c49efa +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_Structs.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_VertexPass.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_VertexPass.hlsl new file mode 100644 index 00000000..3afdff18 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_VertexPass.hlsl @@ -0,0 +1,78 @@ +#ifndef ALLIN1SPRITESHADER_2DRENDERER_VERTEXPASS +#define ALLIN1SPRITESHADER_2DRENDERER_VERTEXPASS + +v2f CombinedShapeLightVertex(Attributes v) +{ + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + v2f o; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + #if UNITY_VERSION >= 60000000 + localPos.xy *= unity_SpriteProps.xy; + #endif + o.vertex = TransformObjectToHClip(localPos); + #else + half3 localPos = v.vertex.xyz; + #if UNITY_VERSION >= 60000000 + localPos.xy *= unity_SpriteProps.xy; + #endif + o.vertex = TransformObjectToHClip(localPos); + #endif + + o.uv = /*TRANSFORM_TEX(v.uv, _MainTex);*/v.uv * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + o.color = v.color; + #if UNITY_VERSION >= 60000000 + o.color *= unity_SpriteColor; + #endif + + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + #if POLARUV_ON + o.uv = v.uv - center; + #endif + + #if ROTATEUV_ON + half2 uvC = v.uv; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + o.uv = mul(rot, uvC); + o.uv += center; + #endif + + #if OUTTEX_ON + o.uvOutTex = CUSTOM_TRANSFORM_TEX(v.uv, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + o.uvOutDistTex = CUSTOM_TRANSFORM_TEX(v.uv, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + o.uvDistTex = CUSTOM_TRANSFORM_TEX(v.uv, _DistortTex_ScaleAndTiling); + #endif + + half4 clipVertex = o.vertex / o.vertex.w; + o.lightingUV = ComputeScreenPos(clipVertex).xy; + + return o; +} + +#endif //ALLIN1SPRITESHADER_2DRENDERER_VERTEXPASS \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_VertexPass.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_VertexPass.hlsl.meta new file mode 100644 index 00000000..7718bf8b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_VertexPass.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a3d20933a82e6e5458ed3502ae2dbebb +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/2DRenderer/AllIn1SpriteShader_2DRenderer_VertexPass.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_CommonFunctions.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_CommonFunctions.hlsl new file mode 100644 index 00000000..075c0a69 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_CommonFunctions.hlsl @@ -0,0 +1,76 @@ +#ifndef ALLIN1SPRITESHADERSRP_COMMONFUNCTIONS +#define ALLIN1SPRITESHADERSRP_COMMONFUNCTIONS + +//Prevent Unity warnings that are not relevant for this shader------------------- +#pragma warning (disable : 3571) // pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them +#pragma warning (disable : 4008) // floating point division by zero +#pragma warning (disable : 3206) // implicit truncation of vector type +//BLURS------------------------------------------------------------------------- +half4 Blur(half2 uv, Texture2D source, SamplerState texSampler, half Intensity) +{ + const half2 texelSize = 1.0 / _ScreenParams.xy; + const half4 color = SAMPLE_TEXTURE2D(source, texSampler, uv); + const half2 offset = Intensity * texelSize; + + half4 accumulatedColor = color; + half accumulatedWeight = 1.0; + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + const half2 sampleUV = uv + half2(x, y) * offset; + const half4 sampleColor = SAMPLE_TEXTURE2D(source, texSampler, sampleUV); + + accumulatedColor += sampleColor; + accumulatedWeight += 1.0; + } + } + + half4 blurredColor = accumulatedColor / accumulatedWeight; + return blurredColor; +} + +half BlurHD_G(half bhqp, half x) +{ + return exp(-(x * x) / (2.0 * bhqp * bhqp)); +} +half4 BlurHD(half2 uv, Texture2D source, SamplerState texSampler, half BlurAmount, half xScale, half yScale) +{ + int iterations = 16; + int halfIterations = iterations / 2; + half sigmaX = 0.1 + BlurAmount * 0.5; + half sigmaY = sigmaX; + half total = 0.0; + half4 ret = half4(0, 0, 0, 0); + for (int iy = 0; iy < iterations; ++iy) + { + half fy = BlurHD_G(sigmaY, half(iy) -half(halfIterations)); + half offsetY = half(iy - halfIterations) * 0.00390625 * xScale; + for (int ix = 0; ix < iterations; ++ix) + { + half fx = BlurHD_G(sigmaX, half(ix) - half(halfIterations)); + half offsetX = half(ix - halfIterations) * 0.00390625 * yScale; + total += fx * fy; + ret += SAMPLE_TEXTURE2D(source, texSampler, uv + half2(offsetX, offsetY)) * fx * fy; + } + } + return ret / total; +} +//----------------------------------------------------------------------- +half rand(half2 seed, half offset) { + return (frac(sin(dot(seed, half2(12.9898, 78.233))) * 43758.5453) + offset) % 1.0; +} + +half rand2(half2 seed, half offset, half speed) { + return (frac(sin(dot(seed * floor(50 + (_Time.x % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; +} + +half rand2CustomTime(half2 seed, half offset, half customTime, half speed) { + return (frac(sin(dot(seed * floor(50 + (customTime % 1.0) * 12. * speed), half2(127.1, 311.7))) * 43758.5453123) + offset) % 1.0; +} +//----------------------------------------------------------------------- +half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax){ + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_CommonFunctions.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_CommonFunctions.hlsl.meta new file mode 100644 index 00000000..976d95aa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_CommonFunctions.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 13806bf35145bcd46a31f91837eda276 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_CommonFunctions.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_FragmentPass.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_FragmentPass.hlsl new file mode 100644 index 00000000..7c7801fa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_FragmentPass.hlsl @@ -0,0 +1,573 @@ +#ifndef ALLIN1SPRITESHADERSRP_FRAGMENTPASS +#define ALLIN1SPRITESHADERSRP_FRAGMENTPASS + +half4 frag(v2f i) : SV_Target +{ + UNITY_SETUP_INSTANCE_ID(i); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); + + //half randomSeed = UNITY_ACCESS_INSTANCED_PROP(Props, _RandomSeed); + float randomSeed = _RandomSeed; + + float texWidth; + float texHeight; + _MainTex.GetDimensions(texWidth, texHeight); + float4 texelSize = float4(1.0 / texWidth, 1 / texHeight, texWidth, texHeight); + + float2 uvRect = i.uv; + half2 center = half2(0.5, 0.5); +#if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + uvRect = half2((i.uv.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uv.y - _MinYUV) / (_MaxYUV - _MinYUV)); +#endif + half2 centerTiled = half2(center.x * _MainTex_ScaleAndTiling.x, center.y * _MainTex_ScaleAndTiling.y); + +#if CLIPPING_ON + half2 tiledUv = half2(i.uv.x / _MainTex_ScaleAndTiling.x, i.uv.y / _MainTex_ScaleAndTiling.y); +#if ATLAS_ON + tiledUv = half2((tiledUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); +#endif + clip((1 - _ClipUvUp) - tiledUv.y); + clip(tiledUv.y - _ClipUvDown); + clip((1 - _ClipUvRight) - tiledUv.x); + clip(tiledUv.x - _ClipUvLeft); +#endif + +#if RADIALCLIPPING_ON + half2 tiledUv2 = half2(i.uv.x / _MainTex_ScaleAndTiling.x, i.uv.y / _MainTex_ScaleAndTiling.y); +#if ATLAS_ON + tiledUv2 = half2((tiledUv2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUv2.y - _MinYUV) / (_MaxYUV - _MinYUV)); +#endif + half startAngle = _RadialStartAngle - _RadialClip; + half endAngle = _RadialStartAngle + _RadialClip2; + half offset0 = clamp(0, 360, startAngle + 360); + half offset360 = clamp(0, 360, endAngle - 360); + half2 atan2Coord = half2(lerp(-1, 1, tiledUv2.x), lerp(-1, 1, tiledUv2.y)); + half atanAngle = atan2(atan2Coord.y, atan2Coord.x) * 57.3; // angle in degrees + if(atanAngle < 0) atanAngle = 360 + atanAngle; + if(atanAngle >= startAngle && atanAngle <= endAngle) discard; + if(atanAngle <= offset360) discard; + if(atanAngle >= offset0) discard; +#endif + +#if TEXTURESCROLL_ON && ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs(((_Time.y + randomSeed) * _TextureScrollXSpeed) + uvRect.x) % 1)), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(((_Time.y + randomSeed) * _TextureScrollYSpeed) + uvRect.y) % 1))); +#endif + +#if OFFSETUV_ON +#if ATLAS_ON + i.uv = half2(_MinXUV + ((_MaxXUV - _MinXUV) * (abs((_OffsetUvX + uvRect.x) % 1))), + _MinYUV + ((_MaxYUV - _MinYUV) * (abs(_OffsetUvY + uvRect.y) % 1))); +#else + i.uv += half2(_OffsetUvX, _OffsetUvY); +#endif +#endif + +#if POLARUV_ON + i.uv = half2(atan2(i.uv.y, i.uv.x) / (2.0f * 3.141592653589f), length(i.uv)); + i.uv *= _MainTex_ScaleAndTiling.xy; +#endif + +#if TWISTUV_ON +#if ATLAS_ON + _TwistUvPosX = ((_MaxXUV - _MinXUV) * _TwistUvPosX) + _MinXUV; + _TwistUvPosY = ((_MaxYUV - _MinYUV) * _TwistUvPosY) + _MinYUV; +#endif + half2 tempUv = i.uv - half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + _TwistUvRadius *= (_MainTex_ScaleAndTiling.x + _MainTex_ScaleAndTiling.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ScaleAndTiling.x, _TwistUvPosY * _MainTex_ScaleAndTiling.y); + i.uv = tempUv; +#endif + +#if FISHEYE_ON + half bind = length(centerTiled); + half2 dF = i.uv - centerTiled; + half dFlen = length(dF); + half fishInt = (3.14159265359 / bind) * (_FishEyeUvAmount + 0.001); + i.uv = centerTiled + (dF / (max(0.0001, dFlen))) * tan(dFlen * fishInt) * bind / tan(bind * fishInt); +#endif + +#if PINCH_ON + half2 dP = i.uv - centerTiled; + half pinchInt = (3.141592 / length(centerTiled)) * (-_PinchUvAmount + 0.001); + i.uv = centerTiled + normalize(dP) * atan(length(dP) * -pinchInt * 10.0) * 0.5 / atan(-pinchInt * 5); +#endif + +#if ZOOMUV_ON + i.uv -= centerTiled; + i.uv = i.uv * _ZoomUvAmount; + i.uv += centerTiled; +#endif + +#if DOODLE_ON + half2 uvCopy = uvRect; + _HandDrawnSpeed = (floor((_Time.x + randomSeed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + i.uv = lerp(i.uv, i.uv + uvCopy, 0.0005 * _HandDrawnAmount); +#endif + +#if SHAKEUV_ON + half xShake = sin((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((_Time.x + randomSeed) * _ShakeUvSpeed * 50) * _ShakeUvY; + i.uv += half2(xShake * 0.012, yShake * 0.01); +#endif + +#if RECTSIZE_ON + i.uv = i.uv.xy * (_RectSize).xx + (((-_RectSize * 0.5) + 0.5)).xx; +#endif + +#if DISTORT_ON +#if ATLAS_ON + i.uvDistTex.x = i.uvDistTex.x * (1 / (_MaxXUV - _MinXUV)); + i.uvDistTex.y = i.uvDistTex.y * (1 / (_MaxYUV - _MinYUV)); +#endif + i.uvDistTex.x += ((_Time.x + randomSeed) * _DistortTexXSpeed) % 1; + i.uvDistTex.y += ((_Time.x + randomSeed) * _DistortTexYSpeed) % 1; + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, i.uvDistTex).r - 0.5) * 0.2 * _DistortAmount; + i.uv.x += distortAmnt; + i.uv.y += distortAmnt; +#endif + +#if WARP_ON + half2 warpUv = half2(i.uv.x / _MainTex_ScaleAndTiling.x, i.uv.y / _MainTex_ScaleAndTiling.y); +#if ATLAS_ON + warpUv = half2((warpUv.x - _MinXUV) / (_MaxXUV - _MinXUV), (warpUv.y - _MinYUV) / (_MaxYUV - _MinYUV)); +#endif + const float tau = 6.283185307179586; + float xWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.x * tau / _WarpScale; + float yWarp = (_Time.y + randomSeed) * _WarpSpeed + warpUv.y * tau / _WarpScale; + float2 warp = float2(sin(xWarp), sin(yWarp)) * _WarpStrength; + i.uv += warp; +#endif + +#if WAVEUV_ON + float2 uvWave = half2(_WaveX * _MainTex_ScaleAndTiling.x, _WaveY * _MainTex_ScaleAndTiling.y) - i.uv; + uvWave %= 1; +#if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; +#endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + float waveTime = _Time.y + randomSeed; + float angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((waveTime * _WaveSpeed)); + i.uv = i.uv + uvWave * sin(angWave) * (_WaveStrength / 1000.0); +#endif + +#if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ScaleAndTiling.x) - uvRect.x); + half yWave = ((0.5 * _MainTex_ScaleAndTiling.y) - uvRect.y) * (texelSize.w / texelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + i.uv += (sin((ripple + (_Time.y + randomSeed) * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; +#endif + +#if WIND_ON + half windOffset = sin((_Time.x + randomSeed) * _GrassSpeed * 10); + half2 windCenter = half2(0.5, 0.1); +#if ATLAS_ON + windCenter.x = ((_MaxXUV - _MinXUV) * windCenter.x) + _MinXUV; + windCenter.y = ((_MaxYUV - _MinYUV) * windCenter.y) + _MinYUV; +#endif +#if !MANUALWIND_ON + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * windOffset), uvRect.y)), 1); +#else + i.uv.x = fmod(abs(lerp(i.uv.x, i.uv.x + (_GrassWind * 0.01 * _GrassManualAnim), uvRect.y)), 1); + windOffset = _GrassManualAnim; +#endif + half2 delta = i.uv - windCenter; + half delta2 = dot(delta.xy, delta.xy); + half2 delta_offset = delta2 * windOffset; + i.uv = i.uv + half2(delta.y, -delta.x) * delta_offset * _GrassRadialBend; +#endif + +#if TEXTURESCROLL_ON && !ATLAS_ON + i.uv.x += ((_Time.y + randomSeed) * _TextureScrollXSpeed) % 1; + i.uv.y += ((_Time.y + randomSeed) * _TextureScrollYSpeed) % 1; +#endif + +#if PIXELATE_ON + half aspectRatio = texelSize.x / texelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + i.uv = floor(i.uv * pixelSize) / pixelSize; +#endif + + half4 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); + half originalAlpha = col.a; + col *= i.color; +#if PREMULTIPLYALPHA_ON + col.rgb *= col.a; +#endif + +#if GLITCH_ON + half2 uvGlitch = uvRect; + uvGlitch.y -= 0.5; + half lineNoise = pow(rand2(floor(uvGlitch * half2(24., 19.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0) * _GlitchAmount + * pow(rand2(floor(uvGlitch * half2(38., 14.) * _GlitchSize) * 4.0, randomSeed, _GlitchSpeed), 3.0); + col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + half2(lineNoise * 0.02 * rand2(half2(2.0, 1), randomSeed, _GlitchSpeed), 0)) * i.color; +#endif + +#if CHROMABERR_ON + half4 r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + half2(_ChromAberrAmount/10, 0)) * i.color; + half4 b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + half2(-_ChromAberrAmount/10, 0)) * i.color; + col = half4(r.r * r.a, col.g, b.b * b.a, max(max(r.a, b.a) * _ChromAberrAlpha, col.a)); +#endif + +#if BLUR_ON +#if ATLAS_ON +#if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, sampler_MainTex, _BlurIntensity, (_MaxXUV - _MinXUV), (_MaxYUV - _MinYUV)) * i.color; +#else + col = Blur(i.uv, _MainTex, sampler_MainTex, _BlurIntensity * (_MaxXUV - _MinXUV)) * i.color; +#endif +#else +#if !BLURISHD_ON + col = BlurHD(i.uv, _MainTex, sampler_MainTex, _BlurIntensity, 1, 1) * i.color; +#else + col = Blur(i.uv, _MainTex, sampler_MainTex, _BlurIntensity) * i.color; +#endif +#endif +#endif + +#if MOTIONBLUR_ON + _MotionBlurAngle = _MotionBlurAngle * 3.1415926; +#define rot(n) mul(n, half2x2(cos(_MotionBlurAngle), -sin(_MotionBlurAngle), sin(_MotionBlurAngle), cos(_MotionBlurAngle))) + _MotionBlurDist = _MotionBlurDist * 0.005; +#if ATLAS_ON + _MotionBlurDist *= (_MaxXUV - _MinXUV); +#endif + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + rot(half2(-_MotionBlurDist, -_MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + rot(half2(-_MotionBlurDist * 2, -_MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + rot(half2(-_MotionBlurDist * 3, -_MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + rot(half2(-_MotionBlurDist * 4, -_MotionBlurDist * 4))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + rot(half2(_MotionBlurDist, _MotionBlurDist))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + rot(half2(_MotionBlurDist * 2, _MotionBlurDist * 2))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + rot(half2(_MotionBlurDist * 3, _MotionBlurDist * 3))); + col.rgb += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + rot(half2(_MotionBlurDist * 4, _MotionBlurDist * 4))); + col.rgb = col.rgb / 9; +#endif + +#if NEGATIVE_ON + col.rgb = lerp(col.rgb, 1 - col.rgb, _NegativeAmount); +#endif + + half luminance = 0; +#if GREYSCALE_ON && !GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); +#endif + +#if GHOST_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 ghostResult; + ghostResult.a = saturate(luminance - _GhostTransparency) * col.a; + ghostResult.rgb = col.rgb * (luminance + _GhostColorBoost); + col = lerp(col, ghostResult, _GhostBlend); +#endif + +#if INNEROUTLINE_ON + half3 innerT = abs(GET_PIXEL(0, _InnerOutlineThickness, i.uv, _MainTex, texelSize) - GET_PIXEL(0, -_InnerOutlineThickness, i.uv, _MainTex, texelSize)); + innerT += abs(GET_PIXEL(_InnerOutlineThickness, 0, i.uv, _MainTex, texelSize) - GET_PIXEL(-_InnerOutlineThickness, 0, i.uv, _MainTex, texelSize)); +#if !ONLYINNEROUTLINE_ON + innerT = (innerT / 2.0) * col.a * _InnerOutlineAlpha; + col.rgb += length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; +#else + innerT *= col.a * _InnerOutlineAlpha; + col.rgb = length(innerT) * _InnerOutlineColor.rgb * _InnerOutlineGlow; + col.a = step(0.3, col.r+col.g+col.b); +#endif +#endif + +#if HITEFFECT_ON + col.rgb = lerp(col.rgb, _HitEffectColor.rgb * _HitEffectGlow, _HitEffectBlend); +#endif + +#if GRADIENT_ON + half2 tiledUvGrad = half2(uvRect.x / _MainTex_ScaleAndTiling.x, uvRect.y / _MainTex_ScaleAndTiling.y); +#if GRADIENT2COL_ON + _GradTopRightCol = _GradTopLeftCol; + _GradBotRightCol = _GradBotLeftCol; +#endif +#if RADIALGRADIENT_ON + half radialDist = 1 - length(tiledUvGrad - half2(0.5, 0.5)); + radialDist *= (texelSize.w / texelSize.z); + radialDist = saturate(_GradBoostX * radialDist); + half4 gradientResult = lerp(_GradTopLeftCol, _GradBotLeftCol, radialDist); +#else + half gradXLerpFactor = saturate(pow(tiledUvGrad.x, _GradBoostX)); + half4 gradientResult = lerp(lerp(_GradBotLeftCol, _GradBotRightCol, gradXLerpFactor), + lerp(_GradTopLeftCol, _GradTopRightCol, gradXLerpFactor), saturate(pow(tiledUvGrad.y, _GradBoostY))); +#endif + gradientResult = lerp(col, gradientResult, _GradBlend); + col.rgb = gradientResult.rgb * col.a; + col.a *= gradientResult.a; +#endif + +#if CONTRAST_ON + col.rgb = (col.rgb - float3(0.5, 0.5, 0.5)) * _Contrast + float3(0.5, 0.5, 0.5); + col.rgb += _Brightness; +#endif + +#if COLORSWAP_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + half4 swapMask = SAMPLE_TEXTURE2D(_ColorSwapTex, sampler_ColorSwapTex, i.uv); + swapMask.rgb *= swapMask.a; + half3 redSwap = _ColorSwapRed * swapMask.r * saturate(luminance + _ColorSwapRedLuminosity); + half3 greenSwap = _ColorSwapGreen * swapMask.g * saturate(luminance + _ColorSwapGreenLuminosity); + half3 blueSwap = _ColorSwapBlue * swapMask.b * saturate(luminance + _ColorSwapBlueLuminosity); + swapMask.rgb = col.rgb * saturate(1 - swapMask.r - swapMask.g - swapMask.b); + col.rgb = lerp(col.rgb, swapMask.rgb + redSwap + greenSwap + blueSwap, _ColorSwapBlend); +#endif + +#if COLORRAMP_ON && !COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); +#if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); +#else + col.rgb = lerp(col.rgb, SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); +#endif +#endif + +#if CHANGECOLOR_ON + float3 currChangeColor = saturate(col.rgb); + luminance = 0.3 * currChangeColor.r + 0.59 * currChangeColor.g + 0.11 * currChangeColor.b; + luminance = saturate(luminance + _ColorChangeLuminosity); + half3 dif = abs(currChangeColor - _ColorChangeTarget.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance), 0.0)); +#if CHANGECOLOR2_ON + dif = abs(currChangeColor - _ColorChangeTarget2.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol2.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance2), 0.0)); +#endif +#if CHANGECOLOR3_ON + dif = abs(currChangeColor - _ColorChangeTarget3.rgb); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _ColorChangeNewCol3.rgb, + max(sign(1 - saturate(dif.x + dif.y + dif.z) - _ColorChangeTolerance3), 0.0)); +#endif +#endif + +#if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); +#endif + +#if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; +#endif + +#if OVERLAY_ON + half2 overlayUvs = uvRect; + overlayUvs.x += ((_Time.y + randomSeed) * _OverlayTextureScrollXSpeed) % 1; + overlayUvs.y += ((_Time.y + randomSeed) * _OverlayTextureScrollYSpeed) % 1; + half4 overlayCol = SAMPLE_TEXTURE2D(_OverlayTex, sampler_OverlayTex, CUSTOM_TRANSFORM_TEX(overlayUvs, _OverlayTex_ScaleAndTiling)); + overlayCol.rgb *= _OverlayColor.rgb * _OverlayGlow; +#if !OVERLAYMULT_ON + overlayCol.rgb *= overlayCol.a * _OverlayColor.rgb * _OverlayColor.a * _OverlayBlend; + col.rgb += overlayCol.rgb; +#else + overlayCol.a *= _OverlayColor.a; + col = lerp(col, col * overlayCol, _OverlayBlend); +#endif +#endif + + //OUTLINE------------------------------------------------------------- +#if OUTBASE_ON + #if OUTBASEPIXELPERF_ON + //half2 destUv = _OutlinePixelWidth / unity_SpriteProps.w; + half2 destUv = half2(_OutlinePixelWidth * texelSize.x, _OutlinePixelWidth * texelSize.y); + #else + //half2 destUv = _OutlinePixelWidth / unity_SpriteProps.w; + half2 destUv = half2(_OutlineWidth * texelSize.x * 200, _OutlineWidth * texelSize.y * 200); + #endif + + #if OUTDIST_ON + half2 uvOutDist = uvRect; + uvOutDist.x += ((_Time.x + randomSeed) * _OutlineDistortTexXSpeed) % 1; + uvOutDist.y += ((_Time.x + randomSeed) * _OutlineDistortTexYSpeed) % 1; + half outDistortAmnt = (SAMPLE_TEXTURE2D(_OutlineDistortTex, sampler_OutlineDistortTex, CUSTOM_TRANSFORM_TEX(uvOutDist, _OutlineDistortTex_ScaleAndTiling)).r - 0.5) * 0.2 * _OutlineDistortAmount; + destUv.x += outDistortAmnt; + destUv.y += outDistortAmnt; + #endif + + half spriteLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + half2(destUv.x, 0)).a; + half spriteRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv - half2(destUv.x, 0)).a; + half spriteBottom = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + half2(0, destUv.y)).a; + half spriteTop = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv - half2(0, destUv.y)).a; + + half result = spriteLeft + spriteRight + spriteBottom + spriteTop; + + #if OUTBASE8DIR_ON + half spriteTopLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + half2(destUv.x, destUv.y)).a; + half spriteTopRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + half2(-destUv.x, destUv.y)).a; + half spriteBotLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + half2(destUv.x, -destUv.y)).a; + half spriteBotRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + half2(-destUv.x, -destUv.y)).a; + + result = result + spriteTopLeft + spriteTopRight + spriteBotLeft + spriteBotRight; + #endif + + result = step(0.05, saturate(result)); + + #if OUTTEX_ON + i.uvOutTex.x += ((_Time.x + randomSeed) * _OutlineTexXSpeed) % 1; + i.uvOutTex.y += ((_Time.x + randomSeed) * _OutlineTexYSpeed) % 1; + #if ATLAS_ON + i.uvOutTex = half2((i.uvOutTex.x - _MinXUV) / (_MaxXUV - _MinXUV), (i.uvOutTex.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half4 tempOutColor = SAMPLE_TEXTURE2D(_OutlineTex, sampler_OutlineTex, i.uvOutTex); + tempOutColor *= _OutlineColor; + _OutlineColor = tempOutColor; + #endif + + result *= (1 - originalAlpha) * _OutlineAlpha; + + half4 outline = _OutlineColor * i.color.a; + outline.rgb *= _OutlineGlow; + outline.a = result; + #if ONLYOUTLINE_ON + col = outline; + #else + col = lerp(col, outline, result); + #endif +#endif + //----------------------------------------------------------------------------- + +#if FADE_ON + half2 tiledUvFade1= CUSTOM_TRANSFORM_TEX(i.uv, _FadeTex_ScaleAndTiling); + half2 tiledUvFade2 = CUSTOM_TRANSFORM_TEX(i.uv, _FadeBurnTex_ScaleAndTiling); +#if ATLAS_ON + tiledUvFade1 = half2((tiledUvFade1.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade1.y - _MinYUV) / (_MaxYUV - _MinYUV)); + tiledUvFade2 = half2((tiledUvFade2.x - _MinXUV) / (_MaxXUV - _MinXUV), (tiledUvFade2.y - _MinYUV) / (_MaxYUV - _MinYUV)); +#endif + half fadeTemp = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fade = smoothstep(_FadeAmount, _FadeAmount + _FadeBurnTransition, fadeTemp); + half fadeBurn = saturate(smoothstep(_FadeAmount - _FadeBurnWidth, _FadeAmount - _FadeBurnWidth + 0.1, fadeTemp) * _FadeAmount); + col.a *= fade; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2) * _FadeBurnColor * originalAlpha * (1 - col.a); +#endif + +#if SHADOW_ON + half shadowA = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv + half2(_ShadowX, _ShadowY)).a; + half preMultShadowMask = 1 - (saturate(shadowA - col.a) * (1 - col.a)); + col.rgb *= 1 - ((shadowA - col.a) * (1 - col.a)); + col.rgb += (_ShadowColor * shadowA) * (1 - col.a); + col.a = max(shadowA * _ShadowAlpha * i.color.a, col.a); +#endif + +#if GLOW_ON + half4 emission; +#if GLOWTEX_ON + emission = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, i.uv); +#else + emission = col; +#endif + col.rgb *= _GlowGlobal; + emission.rgb *= emission.a * col.a * _Glow * _GlowColor; + col.rgb += emission.rgb; +#endif + +#if COLORRAMP_ON && COLORRAMPOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _ColorRampLuminosity); +#if GRADIENTCOLORRAMP_ON + col.rgb = lerp(col.rgb, tex2D(_ColorRampTexGradient, half2(luminance, 0)).rgb, _ColorRampBlend); +#else + col.rgb = lerp(col.rgb, tex2D(_ColorRampTex, half2(luminance, 0)).rgb, _ColorRampBlend); +#endif +#endif + +#if GREYSCALE_ON && GREYSCALEOUTLINE_ON + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance = saturate(luminance + _GreyscaleLuminosity); + col.rgb = lerp(col.rgb, half3(luminance, luminance, luminance) * _GreyscaleTintColor, _GreyscaleBlend); +#endif + +#if POSTERIZE_ON && POSTERIZEOUTLINE_ON + col.rgb = pow(col.rgb, _PosterizeGamma) * _PosterizeNumColors; + col.rgb = floor(col.rgb) / _PosterizeNumColors; + col.rgb = pow(col.rgb, 1.0 / _PosterizeGamma); +#endif + +#if SHINE_ON + half2 uvShine = uvRect; + half cosAngle = cos(_ShineRotate); + half sinAngle = sin(_ShineRotate); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvShine -= half2(0.5, 0.5); + uvShine = mul(rot, uvShine); + uvShine += half2(0.5, 0.5); + half shineMask = SAMPLE_TEXTURE2D(_ShineMask, sampler_ShineMask, i.uv).a; + half currentDistanceProjection = (uvShine.x + uvShine.y) / 2; + half whitePower = 1 - (abs(currentDistanceProjection - _ShineLocation) / _ShineWidth); + col.rgb += col.a * whitePower * _ShineGlow * max(sign(currentDistanceProjection - (_ShineLocation - _ShineWidth)), 0.0) + * max(sign((_ShineLocation + _ShineWidth) - currentDistanceProjection), 0.0) * _ShineColor * shineMask; +#endif + +#if HOLOGRAM_ON + half totalHologram = _HologramStripesAmount + _HologramUnmodAmount; + half hologramYCoord = ((uvRect.y + (((_Time.x + randomSeed) % 1) * _HologramStripesSpeed)) % totalHologram) / totalHologram; + hologramYCoord = abs(hologramYCoord); + half alpha = RemapFloat(saturate(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0, 1.0, _HologramMinAlpha, saturate(_HologramMaxAlpha)); + half hologramMask = max(sign((_HologramUnmodAmount/totalHologram) - hologramYCoord), 0.0); + half4 hologramResult = col; + hologramResult.a *= lerp(alpha, 1, hologramMask); + hologramResult.rgb *= max(1, _HologramMaxAlpha * max(sign(hologramYCoord - (_HologramUnmodAmount/totalHologram)), 0.0)); + hologramMask = 1 - step(0.01,hologramMask); + hologramResult.rgb += hologramMask * _HologramStripeColor * col.a; + col = lerp(col, hologramResult, _HologramBlend); +#endif + +#if FLICKER_ON + col.a *= saturate(col.a * step(frac(0.05 + (_Time.w + randomSeed) * _FlickerFreq), 1 - _FlickerPercent) + _FlickerAlpha); +#endif + +col.a *= _Alpha; + +#if ALPHACUTOFF_ON + clip((1 - _AlphaCutoffValue) - (1 - col.a) - 0.01); +#endif + +#if ALPHAROUND_ON + col.a = step(_AlphaRoundThreshold, col.a); +#endif + +#if ALPHAOUTLINE_ON + half alphaOutlineRes = pow(1 - col.a, max(_AlphaOutlinePower, 0.0001)) * step(_AlphaOutlineMinAlpha, col.a) * _AlphaOutlineBlend; + col.rgb = lerp(col.rgb, _AlphaOutlineColor.rgb * _AlphaOutlineGlow, alphaOutlineRes); + col.a = lerp(col.a, 1, alphaOutlineRes > 1); +#endif + + col *= _Color; + #if !defined(HDRP_PASS) && UNITY_VERSION >= 60000000 + col *= unity_SpriteColor; + #endif + +#if FOG_ON + col = AllIn1MixFog(col, i.vertex, i.positionWS, i.fogCoord); +#endif + + return col; +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_FragmentPass.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_FragmentPass.hlsl.meta new file mode 100644 index 00000000..8cef35ed --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_FragmentPass.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: c219b648ae17310408a5f5ba5b099249 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_FragmentPass.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_HDRPHelper.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_HDRPHelper.hlsl new file mode 100644 index 00000000..afe85a60 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_HDRPHelper.hlsl @@ -0,0 +1,32 @@ +#ifndef ALLIN1SPRITESHADERSRP_HDRPHELPER +#define ALLIN1SPRITESHADERSRP_HDRPHELPER + +//fogCoord only used in URP. It's here to make both functions have the same parameters +float4 AllIn1MixFog(float4 inputColor, float4 clipPos, float3 positionWS, float fogCoord) +{ + float4 res = inputColor; + if (_FogEnabled) + { + PositionInputs posInput = GetPositionInput( + clipPos.xy, + _ScreenSize.zw, + clipPos.z, + clipPos.w, + positionWS, //In HDRP is RWS + 0 + ); + + float3 V = GetWorldSpaceNormalizeViewDir(positionWS); + + float3 fogColor; + float3 fogOpacity; + EvaluateAtmosphericScattering(posInput, V, fogColor, fogOpacity); + + res.rgb = (res.rgb * fogOpacity) + fogColor; + res.a *= (1 - fogOpacity); + } + + return res; +} + +#endif //ALLIN1SPRITESHADERSRP_HDRPHELPER \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_HDRPHelper.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_HDRPHelper.hlsl.meta new file mode 100644 index 00000000..cc348974 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_HDRPHelper.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: c2403e765aad6494d86eaaec9cdd5385 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_HDRPHelper.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Properties.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Properties.hlsl new file mode 100644 index 00000000..8d4673b2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Properties.hlsl @@ -0,0 +1,191 @@ +#ifndef ALLIN1SPRITESHADERSRP_PROPERTIES +#define ALLIN1SPRITESHADERSRP_PROPERTIES + +CBUFFER_START(UnityPerMaterial) + half4 /*_MainTex_ST,*/ /*_MainTex_TexelSize,*/ _Color; + float4 _MainTex_ScaleAndTiling; + + half _Alpha; + + half _MinXUV, _MaxXUV, _MinYUV, _MaxYUV; + + half _RectSize; + + half _OffsetUvX, _OffsetUvY; + + half _ClipUvLeft, _ClipUvRight, _ClipUvUp, _ClipUvDown; + + half _RadialStartAngle, _RadialClip, _RadialClip2; + + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + + half _RotateUvAmount; + + half _FishEyeUvAmount; + + half _PinchUvAmount; + + half _HandDrawnAmount, _HandDrawnSpeed; + + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + + float _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + + half _RoundWaveStrength, _RoundWaveSpeed; + + half _ZoomUvAmount; + + half4 _FadeBurnColor; /*_FadeTex_ST,*/ /*_FadeBurnTex_ST*/ + float4 _FadeTex_ScaleAndTiling, _FadeBurnTex_ScaleAndTiling; + half _FadeAmount, _FadeBurnWidth, _FadeBurnTransition, _FadeBurnGlow; + + half _TextureScrollXSpeed, _TextureScrollYSpeed; + + half4 _GlowColor; + half _Glow, _GlowGlobal; + + + half4 _OutlineColor; + half _OutlineAlpha, _OutlineGlow, _OutlineWidth; + int _OutlinePixelWidth; + + //half4 _OutlineTex_ST; + float4 _OutlineTex_ScaleAndTiling; + half _OutlineTexXSpeed, _OutlineTexYSpeed; + + //half4 _OutlineDistortTex_ST; + float4 _OutlineDistortTex_ScaleAndTiling; + half _OutlineDistortTexXSpeed, _OutlineDistortTexYSpeed, _OutlineDistortAmount; + + //half4 _DistortTex_ST; + float4 _DistortTex_ScaleAndTiling; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + + half _WarpStrength, _WarpSpeed, _WarpScale; + + half _GrassSpeed, _GrassWind, _GrassManualAnim, _GrassRadialBend; + + half _GradBlend, _GradBoostX, _GradBoostY; + half4 _GradTopRightCol, _GradTopLeftCol, _GradBotRightCol, _GradBotLeftCol; + + half4 _ColorSwapRed, _ColorSwapGreen, _ColorSwapBlue; + half _ColorSwapRedLuminosity, _ColorSwapGreenLuminosity, _ColorSwapBlueLuminosity, _ColorSwapBlend; + + half _HsvShift, _HsvSaturation, _HsvBright; + + half4 _HitEffectColor; + half _HitEffectGlow, _HitEffectBlend; + + half _PixelateSize; + + half _NegativeAmount; + + half _ColorRampLuminosity, _ColorRampBlend; + + half _GreyscaleLuminosity, _GreyscaleBlend; + half4 _GreyscaleTintColor; + + half _PosterizeNumColors, _PosterizeGamma; + + half _BlurIntensity; + + half _MotionBlurAngle, _MotionBlurDist; + + half _GhostColorBoost, _GhostTransparency, _GhostBlend; + + half _AlphaOutlineGlow, _AlphaOutlinePower, _AlphaOutlineMinAlpha, _AlphaOutlineBlend; + half4 _AlphaOutlineColor; + + half _InnerOutlineThickness, _InnerOutlineAlpha, _InnerOutlineGlow; + half4 _InnerOutlineColor; + + half _HologramStripesAmount, _HologramMinAlpha, _HologramUnmodAmount, _HologramStripesSpeed, _HologramMaxAlpha, _HologramBlend; + half4 _HologramStripeColor; + + half _ChromAberrAmount, _ChromAberrAlpha; + + half _GlitchAmount, _GlitchSize, _GlitchSpeed; + + half _FlickerFreq, _FlickerPercent, _FlickerAlpha; + + half _ShadowX, _ShadowY, _ShadowAlpha; + half4 _ShadowColor; + + half4 _ShineColor; + half _ShineLocation, _ShineRotate, _ShineWidth, _ShineGlow; + + half _AlphaCutoffValue; + + half _AlphaRoundThreshold; + + half4 _ColorChangeNewCol, _ColorChangeTarget; + half _ColorChangeTolerance, _ColorChangeLuminosity; + + half4 _ColorChangeNewCol2, _ColorChangeTarget2; + half _ColorChangeTolerance2; + + half4 _ColorChangeNewCol3, _ColorChangeTarget3; + half _ColorChangeTolerance3; + + half _Contrast, _Brightness; + + //half4 _OverlayTex_ST; + float4 _OverlayTex_ScaleAndTiling; + float4 _OverlayColor; + half _OverlayGlow, _OverlayBlend, _OverlayTextureScrollXSpeed, _OverlayTextureScrollYSpeed; + + float _RandomSeed; +CBUFFER_END + + +#define CUSTOM_TRANSFORM_TEX(uv, st) uv * st.xy + st.zw +#define GET_PIXEL(offsetX, offsetY, uv, tex, texelSize) SAMPLE_TEXTURE2D(tex, sampler##tex, uv + half2(offsetX * texelSize.x, offsetY * texelSize.y)).rgb +#define DECLARE_TEX_AND_SAMPLER(texName) \ + TEXTURE2D(texName);\ + SAMPLER(sampler##texName); + + +DECLARE_TEX_AND_SAMPLER(_MainTex) + +#if FADE_ON + DECLARE_TEX_AND_SAMPLER(_FadeTex) + DECLARE_TEX_AND_SAMPLER(_FadeBurnTex) +#endif + +#if GLOW_ON + DECLARE_TEX_AND_SAMPLER(_GlowTex) + //sampler2D _GlowTex; +#endif + +#if OUTTEX_ON + DECLARE_TEX_AND_SAMPLER(_OutlineTex) +#endif + +#if OUTDIST_ON + DECLARE_TEX_AND_SAMPLER(_OutlineDistortTex) + //sampler2D _OutlineDistortTex; +#endif + +#if DISTORT_ON + DECLARE_TEX_AND_SAMPLER(_DistortTex) + //sampler2D _DistortTex; +#endif + +#if COLORSWAP_ON + DECLARE_TEX_AND_SAMPLER(_ColorSwapTex) +#endif + +#if COLORRAMP_ON + DECLARE_TEX_AND_SAMPLER(_ColorRampTex) + DECLARE_TEX_AND_SAMPLER(_ColorRampTexGradient) +#endif + +#if SHINE_ON + DECLARE_TEX_AND_SAMPLER(_ShineMask) +#endif + +#if OVERLAY_ON + DECLARE_TEX_AND_SAMPLER(_OverlayTex) +#endif + +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Properties.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Properties.hlsl.meta new file mode 100644 index 00000000..82ba6166 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Properties.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 8b6109d96c9d070479a709f48fb8ccce +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Properties.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_ShaderFeatures.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_ShaderFeatures.hlsl new file mode 100644 index 00000000..371846a4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_ShaderFeatures.hlsl @@ -0,0 +1,76 @@ +#ifndef ALLIN1SPRITESHADERSRP_SHADERFEATURES +#define ALLIN1SPRITESHADERSRP_SHADERFEATURES + +#pragma shader_feature_local GLOW_ON +#pragma shader_feature_local FADE_ON +#pragma shader_feature_local OUTBASE_ON +#pragma shader_feature_local ONLYOUTLINE_ON +#pragma shader_feature_local GRADIENT_ON +#pragma shader_feature_local GRADIENT2COL_ON +#pragma shader_feature_local RADIALGRADIENT_ON +#pragma shader_feature_local COLORSWAP_ON +#pragma shader_feature_local HSV_ON +#pragma shader_feature_local CHANGECOLOR_ON +#pragma shader_feature_local CHANGECOLOR2_ON +#pragma shader_feature_local CHANGECOLOR3_ON +#pragma shader_feature_local COLORRAMP_ON +#pragma shader_feature_local GRADIENTCOLORRAMP_ON +#pragma shader_feature_local HITEFFECT_ON +#pragma shader_feature_local NEGATIVE_ON +#pragma shader_feature_local PIXELATE_ON +#pragma shader_feature_local GREYSCALE_ON +#pragma shader_feature_local POSTERIZE_ON +#pragma shader_feature_local BLUR_ON +#pragma shader_feature_local MOTIONBLUR_ON +#pragma shader_feature_local GHOST_ON +#pragma shader_feature_local ALPHAOUTLINE_ON +#pragma shader_feature_local INNEROUTLINE_ON +#pragma shader_feature_local ONLYINNEROUTLINE_ON +#pragma shader_feature_local HOLOGRAM_ON +#pragma shader_feature_local CHROMABERR_ON +#pragma shader_feature_local GLITCH_ON +#pragma shader_feature_local FLICKER_ON +#pragma shader_feature_local SHADOW_ON +#pragma shader_feature_local SHINE_ON +#pragma shader_feature_local CONTRAST_ON +#pragma shader_feature_local OVERLAY_ON +#pragma shader_feature_local OVERLAYMULT_ON +#pragma shader_feature_local ALPHACUTOFF_ON +#pragma shader_feature_local ALPHAROUND_ON +#pragma shader_feature_local DOODLE_ON +#pragma shader_feature_local WIND_ON +#pragma shader_feature_local WAVEUV_ON +#pragma shader_feature_local ROUNDWAVEUV_ON +#pragma shader_feature_local RECTSIZE_ON +#pragma shader_feature_local OFFSETUV_ON +#pragma shader_feature_local CLIPPING_ON +#pragma shader_feature_local RADIALCLIPPING_ON +#pragma shader_feature_local TEXTURESCROLL_ON +#pragma shader_feature_local ZOOMUV_ON +#pragma shader_feature_local DISTORT_ON +#pragma shader_feature_local WARP_ON +#pragma shader_feature_local TWISTUV_ON +#pragma shader_feature_local ROTATEUV_ON +#pragma shader_feature_local POLARUV_ON +#pragma shader_feature_local FISHEYE_ON +#pragma shader_feature_local PINCH_ON +#pragma shader_feature_local SHAKEUV_ON + +#pragma shader_feature_local GLOWTEX_ON +#pragma shader_feature_local OUTTEX_ON +#pragma shader_feature_local OUTDIST_ON +#pragma shader_feature_local OUTBASE8DIR_ON +#pragma shader_feature_local OUTBASEPIXELPERF_ON +#pragma shader_feature_local COLORRAMPOUTLINE_ON +#pragma shader_feature_local GREYSCALEOUTLINE_ON +#pragma shader_feature_local POSTERIZEOUTLINE_ON +#pragma shader_feature_local BLURISHD_ON +#pragma shader_feature_local MANUALWIND_ON +#pragma shader_feature ATLAS_ON +#pragma shader_feature PREMULTIPLYALPHA_ON + +#pragma shader_feature BILBOARD_ON +#pragma shader_feature BILBOARDY_ON +#pragma shader_feature FOG_ON + +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_ShaderFeatures.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_ShaderFeatures.hlsl.meta new file mode 100644 index 00000000..91d4cca4 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_ShaderFeatures.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: fb77b0e21e6914b448db01edf0081e34 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_ShaderFeatures.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Structs.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Structs.hlsl new file mode 100644 index 00000000..be71582f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Structs.hlsl @@ -0,0 +1,40 @@ +#ifndef ALLIN1SPRITESHADERSRP_STRUCTS +#define ALLIN1SPRITESHADERSRP_STRUCTS + +struct appdata +{ + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + half4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID +}; + +struct v2f +{ + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + half4 color : COLOR; + +#if OUTTEX_ON + half2 uvOutTex : TEXCOORD1; +#endif + +#if OUTDIST_ON + half2 uvOutDistTex : TEXCOORD2; +#endif + +#if DISTORT_ON + half2 uvDistTex : TEXCOORD3; +#endif + +#if FOG_ON + float fogCoord : TEXCOORD4; +#endif + + float3 positionWS : TEXCOORD5; + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO +}; + +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Structs.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Structs.hlsl.meta new file mode 100644 index 00000000..ee81121f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Structs.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 90c9bb4f3a943e54ab9fe837a2ffe287 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_Structs.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_URPHelper.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_URPHelper.hlsl new file mode 100644 index 00000000..e5c7492e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_URPHelper.hlsl @@ -0,0 +1,14 @@ +#ifndef ALLIN1SPRITESHADERSRP_URPHELPER +#define ALLIN1SPRITESHADERSRP_URPHELPER + +//clipPos and positionWS only used in HDRP. They're here to make both functions have the same parameters +float4 AllIn1MixFog(float4 inputColor, float4 clipPos, float3 positionWS, float fogCoord) +{ + float4 res = inputColor; + + res.rgb = MixFog(inputColor.rgb, fogCoord); + + return res; +} + +#endif //ALLIN1SPRITESHADERSRP_URPHELPER \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_URPHelper.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_URPHelper.hlsl.meta new file mode 100644 index 00000000..86bdbd1b --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_URPHelper.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 27824951bd98b3140ba8ba40179436c4 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_URPHelper.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_VertexPass.hlsl b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_VertexPass.hlsl new file mode 100644 index 00000000..17397bb3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_VertexPass.hlsl @@ -0,0 +1,81 @@ +#ifndef ALLIN1SPRITESHADERSRP_VERTEXPASS +#define ALLIN1SPRITESHADERSRP_VERTEXPASS + +v2f vert(appdata v) +{ + #if RECTSIZE_ON + v.vertex.xyz += (v.vertex.xyz * (_RectSize - 1.0)); + #endif + + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + #if BILBOARD_ON + half3 camRight = mul((half3x3)unity_CameraToWorld, half3(1,0,0)); + half3 camUp = half3(0,1,0); + #if BILBOARDY_ON + camUp = mul((half3x3)unity_CameraToWorld, half3(0,1,0)); + #endif + half3 localPos = v.vertex.x * camRight + v.vertex.y * camUp; + + #if UNITY_VERSION >= 60000000 + localPos.xy *= unity_SpriteProps.xy; + #endif + o.vertex = TransformObjectToHClip(half4(localPos, 1).xyz); + #else + half3 localPos = v.vertex.xyz; + #if UNITY_VERSION >= 60000000 && !defined(HDRP_PASS) + localPos.xy *= unity_SpriteProps.xy; + #endif + o.vertex = TransformObjectToHClip(localPos); + #endif + o.uv = /*TRANSFORM_TEX(v.uv, _MainTex)*/v.uv * _MainTex_ScaleAndTiling.xy + _MainTex_ScaleAndTiling.zw; + o.color = v.color; + + half2 center = half2(0.5, 0.5); + #if ATLAS_ON + center = half2((_MaxXUV + _MinXUV) / 2.0, (_MaxYUV + _MinYUV) / 2.0); + #endif + + #if POLARUV_ON + o.uv = v.uv - center; + #endif + + #if ROTATEUV_ON + half2 uvC = v.uv; + half cosAngle = cos(_RotateUvAmount); + half sinAngle = sin(_RotateUvAmount); + half2x2 rot = half2x2(cosAngle, -sinAngle, sinAngle, cosAngle); + uvC -= center; + o.uv = mul(rot, uvC); + o.uv += center; + #endif + + #if OUTTEX_ON + o.uvOutTex = CUSTOM_TRANSFORM_TEX(v.uv, _OutlineTex_ScaleAndTiling); + #endif + + #if OUTDIST_ON + o.uvOutDistTex = CUSTOM_TRANSFORM_TEX(v.uv, _OutlineDistortTex_ScaleAndTiling); + #endif + + #if DISTORT_ON + o.uvDistTex = CUSTOM_TRANSFORM_TEX(v.uv, _DistortTex_ScaleAndTiling); + #endif + + #if FOG_ON + o.fogCoord = 0; + #if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2) + o.fogCoord = ComputeFogFactor(o.vertex.z); + #endif + #endif + + o.positionWS = TransformObjectToWorld(v.vertex.xyz); + + + return o; +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_VertexPass.hlsl.meta b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_VertexPass.hlsl.meta new file mode 100644 index 00000000..0c893326 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_VertexPass.hlsl.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 5b28c43114df6394c8e01e077af6cae9 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Shaders/ShaderLibrary/AllIn1SpriteShaderSRP_VertexPass.hlsl + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Start_Here.txt b/Assets/Plugins/AllIn1SpriteShader/Start_Here.txt new file mode 100644 index 00000000..4e3b03fa --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Start_Here.txt @@ -0,0 +1,19 @@ +Hi there! Thanks for purchasing the asset, I really hope you enjoy it and that it helps you take your projects to the next level :D + +If this is your first time using the asset reading the First Steps section of the Documentation PDF or watching this quick overview video is the best place to start: +https://youtu.be/ThvqkJ5q-gk +You will learn the basic workflow in a matter of minutes. And then, to learn all the asset can do you can proceed to read the rest of the Documentation or to watch all the other video tutorials. + +The asset is mainly targeted to be used in sprites and UI. But it can be used anywhere. Many creative users also use the asset in Meshes and VFX materials. +That being said I just made a new specialized asset for VFX. It's a spiritual successor to this asset but made with VFX creation in mind. +It has an awesome shader, more than 50 ready to use example prefabs, a huge asset library, editor tools and more. +Get it here with a HUGE DISCOUNT for owning this asset: https://assetstore.unity.com/packages/vfx/all-in-1-vfx-toolkit-206665 + + +I’m always open for questions, feedback and suggestions. The best way to contact me is by email. Please don’t write questions in the Unity Forums, Youtube videos, Twitter or wherever else since I will probably miss them. +I always reply much faster (in 24h or less) by email. +When reaching out please attach your invoice number too and make sure you have read the Documentation PDF or watched the equivalent video playlist linked in the PDF. +The email address is: seasidegamestudios@gmail.com + +If you like the asset please make sure to drop a review on the Asset Store page. It helps out a ton: +https://assetstore.unity.com/packages/vfx/shaders/all-in-1-sprite-shader-156513 \ No newline at end of file diff --git a/Assets/Plugins/AllIn1SpriteShader/Start_Here.txt.meta b/Assets/Plugins/AllIn1SpriteShader/Start_Here.txt.meta new file mode 100644 index 00000000..7ffaefb1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Start_Here.txt.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 40da9e3a3b0e50c4599a7abc58b8598e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Start_Here.txt + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures.meta b/Assets/Plugins/AllIn1SpriteShader/Textures.meta new file mode 100644 index 00000000..3b81dbc5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9c6641ac06ac9d643898c55a675118f8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures.meta new file mode 100644 index 00000000..1cadac33 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5dc994715c67a694eafe9d1fba38560d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png new file mode 100644 index 00000000..01d510db Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png.meta new file mode 100644 index 00000000..7764d283 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 7062336ff4b66994caa2ba23c8651342 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 6534a81033212394099b1c2e60060263 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_1.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png new file mode 100644 index 00000000..f925cc55 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png.meta new file mode 100644 index 00000000..c1ac5534 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 2eb26501acf862843a55a2e79af0c3c8 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: b49496914e94fc94f80d6b9197ecf935 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/gradientTexture_2.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd new file mode 100644 index 00000000..266704b3 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd.meta new file mode 100644 index 00000000..a642970d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: a9058d3dd9b9dd14cbc6b16db7859653 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 6b5fce476d6279846b6aee1cf9447c38 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-bumbleberry.psd + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd new file mode 100644 index 00000000..17ab124a Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd.meta new file mode 100644 index 00000000..4c3aee37 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: bf981ecbfe649344eafdbc788f6dab0f +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: c61c2ea72b408804c90e310880261312 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-cool.psd + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png new file mode 100644 index 00000000..3c108bae Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png.meta new file mode 100644 index 00000000..018442d2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 279657edc397ece4b8029c727adf6ddc +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 85966af9cdddb7d4bbd347c94e844740 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-downwell.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd new file mode 100644 index 00000000..e302149b Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd.meta new file mode 100644 index 00000000..8882807e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: b3cfc9bf16a1cfa4ab153965dff63ad3 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: f38908602dd238b409bc43bb9953646d + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-earthy.psd + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png new file mode 100644 index 00000000..d98dd2dd Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png.meta new file mode 100644 index 00000000..4f48808e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 763e13699209a614b8800c76fc9dee48 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 4acacabd6b7da7644a38538f7ac969fa + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy-pop-1x.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd new file mode 100644 index 00000000..9daeca3c Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd.meta new file mode 100644 index 00000000..b5a64f6e --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 285a35f6ccf7b1a44b6c198e96105173 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 45d692c8481a23a4ca4bf338eb345b89 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-gameboy.psd + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png new file mode 100644 index 00000000..4b94e7a7 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png.meta new file mode 100644 index 00000000..e5bfb820 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 54b37de4aa07caa4797254cf2351058f +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: fdaff416f4292e748acd0edc2ccd3a1b + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-metroid-ii-sgb-1x.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png new file mode 100644 index 00000000..432a5863 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png.meta new file mode 100644 index 00000000..d51a8b9f --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 359431ef2af87794198688f7c632c1e3 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: c8412b3bf254b83478e63d50248d9511 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-mist-gb-1x.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd new file mode 100644 index 00000000..07d74a30 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd.meta new file mode 100644 index 00000000..87fb1b39 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: cbb1819678c0e5a4c82464e4b1c0ce1c +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: bbc95717f5bfe2342801eb1509f0c21e + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-neapolitan.psd + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png new file mode 100644 index 00000000..f7b95543 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png.meta new file mode 100644 index 00000000..4f04e4c1 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 8700b580d2f74da46b4cbcb5fde72d63 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 8bac87bbb6aabc449b1dbd4f1da1819f + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-bgb-1x.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png new file mode 100644 index 00000000..dc91c105 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png.meta new file mode 100644 index 00000000..d7730780 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 2a39734b8956da843adee1646c75554f +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 9deeee28a79225f4fb4d99a97a42b3ea + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-nintendo-gameboy-black-zero-1x.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png new file mode 100644 index 00000000..0ca0255f Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png.meta new file mode 100644 index 00000000..40ab32f0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 6fc6eee88963e63429ed61892dadd042 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5a250b7cef21ca84d8fc79970b91cc65 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/palette-platinum-1x.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png new file mode 100644 index 00000000..d9dc310b Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png.meta new file mode 100644 index 00000000..109c982d --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 555ec36b8c5401649af750d9738c7ddf +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 592402d35dab4094da345853c417524b + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/shadeRamp.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png new file mode 100644 index 00000000..482d4a42 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png.meta new file mode 100644 index 00000000..9c1909d2 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 536abb94c423a3443b5151f665cdc017 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: f37da52049ecfd04eb6a0a5176418ac1 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/GradientTextures/toonShadeRamp.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps.meta new file mode 100644 index 00000000..8a057222 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c509d09ace1b4f84da7401dc3c5616a3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png b/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png new file mode 100644 index 00000000..09c35811 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png.meta new file mode 100644 index 00000000..3124b7d5 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 115ee11beb34a5247bc5bd53377a08f2 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 04a63e1d3a18ab9419ae1e2e245ef80a + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/NormalMaps/spaceSoldierNormalMap.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png b/Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png new file mode 100644 index 00000000..e5ae7745 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png.meta new file mode 100644 index 00000000..a9c3d0dd --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: a4a73598226c9dd48aedc26a44264bdf +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 32 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 49b78288c6606b142947c3702972ad14 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/UVChecker.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/black.png b/Assets/Plugins/AllIn1SpriteShader/Textures/black.png new file mode 100644 index 00000000..72d8393c Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/black.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/black.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/black.png.meta new file mode 100644 index 00000000..beb32870 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/black.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 0b8da974a6429b8489e21c2a5d8dd509 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: f397292dae7cff94fa11946d513d2c05 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/black.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/fire.png b/Assets/Plugins/AllIn1SpriteShader/Textures/fire.png new file mode 100644 index 00000000..b58d4341 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/fire.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/fire.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/fire.png.meta new file mode 100644 index 00000000..b246bce0 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/fire.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 253ade5030af1b643bf9a54cceb26f01 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 87af0f70de267414287ea2f131be64a9 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/fire.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png b/Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png new file mode 100644 index 00000000..6f97d829 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png.meta new file mode 100644 index 00000000..228f8a63 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 677cca399782dea41aedc1d292ecb67d +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 164c93aa3c349884aab20273f4e027ed + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/fire2.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png new file mode 100644 index 00000000..d2078ef6 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png.meta new file mode 100644 index 00000000..3cadd561 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 806e236bc12668e4da974bb8f536d28f +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 00ad019334681ad4e94f90f4e6870ade + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png new file mode 100644 index 00000000..de6a4f8f Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png.meta new file mode 100644 index 00000000..da1486b3 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: e3763a0fd85c67f4f9f31b55f886d31d +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: df4dc4f6bf59b0046b0f0b70b9c13a19 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/flameNoise2.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png new file mode 100644 index 00000000..b9b4c0a2 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png.meta new file mode 100644 index 00000000..8c487ffc --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: b2ae57e82cd4b4d4ebfa9986f7c77c83 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: e7046a03f726c4e48b86b2beaa92795d + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/gradient.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png new file mode 100644 index 00000000..8e3e92f8 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png.meta new file mode 100644 index 00000000..5fb18879 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png.meta @@ -0,0 +1,117 @@ +fileFormatVersion: 2 +guid: dbaa905cec0d2b944b5d1ebdbc3ceb1e +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: fe5dc1f04fb78b54aab6a687e244d6d7 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/gradient2.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png b/Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png new file mode 100644 index 00000000..6dc1b236 Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png.meta new file mode 100644 index 00000000..2eb3eaf8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 74087f6d03f233e4a8a142fa01f9e5cf +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: adace43c9876fa64fb0fa83de503839c + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/rainbow.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png b/Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png new file mode 100644 index 00000000..6b9b495b Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png.meta new file mode 100644 index 00000000..a89b3311 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: 7aad8c583ef292e48b06af0d1f2fab97 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 50 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 59e65a015812bfd44aabe97ca2ef2ca1 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/seamlessNoise.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png b/Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png new file mode 100644 index 00000000..8211cb6c Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png.meta new file mode 100644 index 00000000..f8adfa85 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png.meta @@ -0,0 +1,139 @@ +fileFormatVersion: 2 +guid: f96aebb9bcd1e3b44bafbb23b1bdac88 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: c347a607987f5654397113952ea0e2bd + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/toonSeamlessNoise.png + uploadId: 919916 diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/white.png b/Assets/Plugins/AllIn1SpriteShader/Textures/white.png new file mode 100644 index 00000000..944b045d Binary files /dev/null and b/Assets/Plugins/AllIn1SpriteShader/Textures/white.png differ diff --git a/Assets/Plugins/AllIn1SpriteShader/Textures/white.png.meta b/Assets/Plugins/AllIn1SpriteShader/Textures/white.png.meta new file mode 100644 index 00000000..3efa89a8 --- /dev/null +++ b/Assets/Plugins/AllIn1SpriteShader/Textures/white.png.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 839adabbc5de26041bac66450214a831 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 407e6d8edc94c6b4a9325118700cfe09 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156513 + packageName: All In 1 Sprite Shader + packageVersion: 4.68 + assetPath: Assets/Plugins/AllIn1SpriteShader/Textures/white.png + uploadId: 919916 diff --git a/Assets/Plugins/Demigiant.meta b/Assets/Plugins/Demigiant.meta new file mode 100644 index 00000000..07eabc86 --- /dev/null +++ b/Assets/Plugins/Demigiant.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8fd0a986bceb4a842ab51821c47aed42 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Demigiant/DOTween.meta b/Assets/Plugins/Demigiant/DOTween.meta new file mode 100644 index 00000000..07db27fb --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: a50bd9a009c8dfc4ebd88cc8101225a7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +labels: +- Tween +- Tweening +- Animation +- HOTween +- Paths +- iTween +- DFTween +- LeanTween +- Ease +- Easing +- Shake +- Punch +- 2DToolkit +- TextMeshPro +- Text +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/Demigiant/DOTween/DOTween.XML b/Assets/Plugins/Demigiant/DOTween/DOTween.XML new file mode 100644 index 00000000..f56085a8 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/DOTween.XML @@ -0,0 +1,3107 @@ + + + + DOTween + + + + + Types of autoPlay behaviours + + + + No tween is automatically played + + + Only Sequences are automatically played + + + Only Tweeners are automatically played + + + All tweens are automatically played + + + + What axis to constrain in case of Vector tweens + + + + Called the first time the tween is set in a playing state, after any eventual delay + + + + Used in place of System.Func, which is not available in mscorlib. + + + + + Used in place of System.Action. + + + + + Public so it can be used by lose scripts related to DOTween (like DOTweenAnimation) + + + + + Used to separate DOTween class from the MonoBehaviour instance (in order to use static constructors on DOTween). + Contains all instance-based methods + + + + Used internally inside Unity Editor, as a trick to update DOTween's inspector at every frame + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + + This class contains a C# port of the easing equations created by Robert Penner (http://robertpenner.com/easing). + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration. + + + Current time (in frames or seconds). + + + Expected easing duration (in frames or seconds). + + Unused: here to keep same delegate for all ease types. + Unused: here to keep same delegate for all ease types. + + The eased value. + + + + + Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected. + Use this method if you don't care about , otherwise use + + + + + USE THIS FOR CUSTOM PLUGINS when you want to be able to use . + Returns a value that is from 0 to 1 if is not incremental, otherwise from 0 to (1 * completed loops) + + + + + Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected + + + + + Used to interpret AnimationCurves as eases. + Public so it can be used by external ease factories + + + + + Behaviour in case a tween nested inside a Sequence fails and is captured by safe mode + + + + If the Sequence contains other elements, kill the failed tween but preserve the rest + + + Kill the whole Sequence + + + + Log types thrown by errors captured and prevented by safe mode + + + + No logs. NOT RECOMMENDED + + + Throw a normal log + + + Throw a warning log (default) + + + Throw an error log + + + + Additional notices passed to plugins when updating. + Public so it can be used by custom plugins. Internally, only PathPlugin uses it + + + + + None + + + + + Lets the plugin know that we restarted or rewinded + + + + + OnRewind callback behaviour (can only be set via DOTween's Utility Panel) + + + + + When calling Rewind or PlayBackwards/SmoothRewind, OnRewind callbacks will be fired only if the tween isn't already rewinded + + + + + When calling Rewind, OnRewind callbacks will always be fired, even if the tween is already rewinded. + When calling PlayBackwards/SmoothRewind instead, OnRewind callbacks will be fired only if the tween isn't already rewinded + + + + + When calling Rewind or PlayBackwards/SmoothRewind, OnRewind callbacks will always be fired, even if the tween is already rewinded + + + + + Public only so custom shortcuts can access some of these methods + + + + + INTERNAL: used by DO shortcuts and Modules to set special startup mode + + + + + INTERNAL: used by DO shortcuts and Modules to set the tween as blendable + + + + + INTERNAL: used by DO shortcuts and Modules to prevent a tween from using a From setup even if passed + + + + + Used to dispatch commands that need to be captured externally, usually by Modules + + + + + Various utils + + + + + Returns a Vector3 with z = 0 + + + + + Returns the 2D angle between two vectors + + + + + Returns a point on a circle with the given center and radius, + using Unity's circle coordinates (0° points up and increases clockwise) + + + + + Uses approximate equality on each axis instead of Unity's Vector3 equality, + because the latter fails (in some cases) when assigning a Vector3 to a transform.position and then checking it. + + + + + Looks for the type within all possible project assembly names + + + + NO-GC METHOD: changes the start value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new start value + If bigger than 0 applies it as the new tween duration + + + NO-GC METHOD: changes the end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new end value + If TRUE the start value will become the current target's value, otherwise it will stay the same + + + NO-GC METHOD: changes the end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new end value + If bigger than 0 applies it as the new tween duration + If TRUE the start value will become the current target's value, otherwise it will stay the same + + + NO-GC METHOD: changes the start and end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new start value + The new end value + If bigger than 0 applies it as the new tween duration + + + + Struct that stores two colors (used for LineRenderer tweens) + + + + + Used for tween callbacks + + + + + Used for tween callbacks + + + + + Used for custom and animationCurve-based ease functions. Must return a value between 0 and 1. + + + + + Straight Quaternion plugin. Instead of using Vector3 values accepts Quaternion values directly. + Beware: doesn't work with LoopType.Incremental (neither directly nor if inside a LoopType.Incremental Sequence). + To use it, call DOTween.To with the plugin parameter overload, passing it PureQuaternionPlugin.Plug() as first parameter + (do not use any of the other public PureQuaternionPlugin methods): + DOTween.To(PureQuaternionPlugin.Plug(), ()=> myQuaternionProperty, x=> myQuaternionProperty = x, myQuaternionEndValue, duration); + + + + + Plug this plugin inside a DOTween.To call. + Example: + DOTween.To(PureQuaternionPlugin.Plug(), ()=> myQuaternionProperty, x=> myQuaternionProperty = x, myQuaternionEndValue, duration); + + + + INTERNAL: do not use + + + INTERNAL: do not use + + + INTERNAL: do not use + + + INTERNAL: do not use + + + INTERNAL: do not use + + + INTERNAL: do not use + + + INTERNAL: do not use + + + INTERNAL: do not use + + + + Extra non-tweening-related curve methods + + + + + Cubic bezier curve methods + + + + + Calculates a point along the given Cubic Bezier segment-curve. + + Segment start point + Start point's control point/handle + Segment end point + End point's control point/handle + 0-1 percentage along which to retrieve point + + + + Returns an array containing a series of points along the given Cubic Bezier segment-curve. + + Start point + Start point's control point/handle + End point + End point's control point/handle + Cloud resolution (min: 2) + + + + Calculates a series of points along the given Cubic Bezier segment-curve and adds them to the given list. + + Start point + Start point's control point/handle + End point + End point's control point/handle + Cloud resolution (min: 2) + + + + Main DOTween class. Contains static methods to create and control tweens in a generic way + + + + DOTween's version + + + If TRUE (default) makes tweens slightly slower but safer, automatically taking care of a series of things + (like targets becoming null while a tween is playing). + Default: TRUE + + + Log type when safe mode reports capturing an error and preventing it + + + Behaviour in case a tween nested inside a Sequence fails (and is caught by safe mode). + Default: NestedTweenFailureBehaviour.TryToPreserveSequence + + + If TRUE you will get a DOTween report when exiting play mode (only in the Editor). + Useful to know how many max Tweeners and Sequences you reached and optimize your final project accordingly. + Beware, this will slightly slow down your tweens while inside Unity Editor. + Default: FALSE + + + Global DOTween global timeScale (default: 1). + The final timeScale of a non-timeScaleIndependent tween is: + Unity's Time.timeScale * DOTween.timeScale * tween.timeScale + while the final timeScale of a timeScaleIndependent tween is: + DOTween.unscaledTimeScale * DOTween.timeScale * tween.timeScale + + + DOTween timeScale applied only to timeScaleIndependent tweens (default: 1). + The final timeScale of a timeScaleIndependent tween is: + DOTween.unscaledTimeScale * DOTween.timeScale * tween.timeScale + + + If TRUE, DOTween will use Time.smoothDeltaTime instead of Time.deltaTime for UpdateType.Normal and UpdateType.Late tweens + (unless they're set as timeScaleIndependent, in which case a value between the last timestep + and will be used instead). + Setting this to TRUE will lead to smoother animations. + Default: FALSE + + + If is TRUE, this indicates the max timeStep that an independent update call can last. + Setting this to TRUE will lead to smoother animations. + Default: FALSE + + + DOTween's log behaviour. + Default: LogBehaviour.ErrorsOnly + + + Used to intercept DOTween's logs. If this method isn't NULL, DOTween will call it before writing a log via Unity's own Debug log methods. + Return TRUE if you want DOTween to proceed with the log, FALSE otherwise. + This method must return a bool and accept two parameters: + - LogType: the type of Unity log that DOTween is trying to log + - object: the log message that DOTween wants to log + + + If TRUE draws path gizmos in Unity Editor (if the gizmos button is active). + Deactivate this if you want to avoid gizmos overhead while in Unity Editor + + + Gets/sets the max Tweeners capacity (automatically increased by DOTween when necessary). + You can also set both Tweeners and Sequences capacity via the static method + + + Gets/sets the max Sequences capacity (automatically increased by DOTween when necessary). + You can also set both Tweeners and Sequences capacity via the static method + + + If TRUE activates various debug options + + + Stores the target id so it can be used to give more info in case of safeMode error capturing. + Only active if both debugMode and useSafeMode are TRUE + + + Default updateType for new tweens. + Default: UpdateType.Normal + + + Sets whether Unity's timeScale should be taken into account by default or not. + Default: false + + + Default autoPlay behaviour for new tweens. + Default: AutoPlay.All + + + Default autoKillOnComplete behaviour for new tweens. + Default: TRUE + + + Default loopType applied to all new tweens. + Default: LoopType.Restart + + + If TRUE all newly created tweens are set as recyclable, otherwise not. + Default: FALSE + + + Default ease applied to all new Tweeners (not to Sequences which always have Ease.Linear as default). + Default: Ease.InOutQuad + + + Default overshoot/amplitude used for eases + Default: 1.70158f + + + Default period used for eases + Default: 0 + + + Used internally. Assigned/removed by DOTweenComponent.Create/DestroyInstance + + + + Must be called once, before the first ever DOTween call/reference, + otherwise it will be called automatically and will use default options. + Calling it a second time won't have any effect. + You can chain SetCapacity to this method, to directly set the max starting size of Tweeners and Sequences: + DOTween.Init(false, false, LogBehaviour.Default).SetCapacity(100, 20); + + If TRUE all new tweens will be set for recycling, meaning that when killed, + instead of being destroyed, they will be put in a pool and reused instead of creating new tweens. This option allows you to avoid + GC allocations by reusing tweens, but you will have to take care of tween references, since they might result active + even if they were killed (since they might have been respawned and are now being used for other tweens). + If you want to automatically set your tween references to NULL when a tween is killed + you can use the OnKill callback like this: + .OnKill(()=> myTweenReference = null) + You can change this setting at any time by changing the static property, + or you can set the recycling behaviour for each tween separately, using: + SetRecyclable(bool recyclable) + Default: FALSE + If TRUE makes tweens slightly slower but safer, automatically taking care of a series of things + (like targets becoming null while a tween is playing). + You can change this setting at any time by changing the static property. + Default: FALSE + Type of logging to use. + You can change this setting at any time by changing the static property. + Default: ErrorsOnly + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + + Kills all tweens, clears all cached tween pools and plugins and resets the max Tweeners/Sequences capacities to the default values. + + If TRUE also destroys DOTween's gameObject and resets its initializiation, default settings and everything else + (so that next time you use it it will need to be re-initialized) + + + + Clears all cached tween pools. + + + + + Checks all active tweens to find and remove eventually invalid ones (usually because their targets became NULL) + and returns the total number of invalid tweens found and removed. + IMPORTANT: this will cause an error on UWP platform, so don't use it there + BEWARE: this is a slightly expensive operation so use it with care + + + + + Updates all tweens that are set to . + + Manual deltaTime + Unscaled delta time (used with tweens set as timeScaleIndependent) + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a property or field to the given value using a custom plugin + The plugin to use. Each custom plugin implements a static Get() method + you'll need to call to assign the correct plugin in the correct way, like this: + CustomPlugin.Get() + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens only one axis of a Vector3 to the given value using default plugins. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + The axis to tween + + + Tweens only the alpha of a Color to the given value using default plugins + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end value to reachThe tween's duration + + + Tweens a virtual property from the given start to the given end value + and implements a setter that allows to use that value with an external method or a lambda + Example: + To(MyMethod, 0, 12, 0.5f); + Where MyMethod is a function that accepts a float parameter (which will be the result of the virtual tween) + The action to perform with the tweened value + The value to start from + The end value to reach + The duration of the virtual tween + + + + Punches a Vector3 towards the given direction and then back to the starting one + as if it was connected to the starting position via an elastic. + This tween type generates some GC allocations at startup + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The direction and strength of the punch + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + 1 creates a full oscillation between the direction and the opposite decaying direction, + while 0 oscillates only between the starting position and the decaying direction + + + Shakes a Vector3 with the given values. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction and behave like a random punch. + If TRUE only shakes on the X Y axis (looks better with things like cameras). + If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + Randomness mode + + + Shakes a Vector3 with the given values. + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction and behave like a random punch. + If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + Randomness mode + + + Tweens a property or field to the given values using default plugins. + Ease is applied between each segment and not as a whole. + This tween type generates some GC allocations at startup + A getter for the field or property to tween. + Example usage with lambda:()=> myProperty + A setter for the field or property to tween + Example usage with lambda:x=> myProperty = x + The end values to reach for each segment. This array must have the same length as durations + The duration of each segment. This array must have the same length as endValues + + + + Returns a new to be used for tween groups. + Mind that Sequences don't have a target applied automatically like Tweener creation shortcuts, + so if you want to be able to kill this Sequence when calling DOTween.Kill(target) you'll have to add + the target manually; you can do that directly by using the overload instead of this one + + + + + Returns a new to be used for tween groups, and allows to set a target + (because Sequences don't have their target set automatically like Tweener creation shortcuts). + That way killing/controlling tweens by target will apply to this Sequence too. + + The target of the Sequence. Relevant only for static target-based methods like DOTween.Kill(target), + useless otherwise + + + Completes all tweens and returns the number of actual tweens completed + (meaning tweens that don't have infinite loops and were not already complete) + For Sequences only: if TRUE also internal Sequence callbacks will be fired, + otherwise they will be ignored + + + Completes all tweens with the given ID or target and returns the number of actual tweens completed + (meaning the tweens that don't have infinite loops and were not already complete) + For Sequences only: if TRUE internal Sequence callbacks will be fired, + otherwise they will be ignored + + + Flips all tweens (changing their direction to forward if it was backwards and viceversa), + then returns the number of actual tweens flipped + + + Flips the tweens with the given ID or target (changing their direction to forward if it was backwards and viceversa), + then returns the number of actual tweens flipped + + + Sends all tweens to the given position (calculating also eventual loop cycles) and returns the actual tweens involved + + + Sends all tweens with the given ID or target to the given position (calculating also eventual loop cycles) + and returns the actual tweens involved + + + Kills all tweens and returns the number of actual tweens killed + If TRUE completes the tweens before killing them + + + Kills all tweens and returns the number of actual tweens killed + If TRUE completes the tweens before killing them + Eventual IDs or targets to exclude from the killing + + + Kills all tweens with the given ID or target and returns the number of actual tweens killed + If TRUE completes the tweens before killing them + + + Kills all tweens with the given target and the given ID, and returns the number of actual tweens killed + If TRUE completes the tweens before killing them + + + Pauses all tweens and returns the number of actual tweens paused + + + Pauses all tweens with the given ID or target and returns the number of actual tweens paused + (meaning the tweens that were actually playing and have been paused) + + + Plays all tweens and returns the number of actual tweens played + (meaning tweens that were not already playing or complete) + + + Plays all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already playing or complete) + + + Plays all tweens with the given target and the given ID, and returns the number of actual tweens played + (meaning the tweens that were not already playing or complete) + + + Plays backwards all tweens and returns the number of actual tweens played + (meaning tweens that were not already started, playing backwards or rewinded) + + + Plays backwards all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already started, playing backwards or rewinded) + + + Plays backwards all tweens with the given target and ID and returns the number of actual tweens played + (meaning the tweens that were not already started, playing backwards or rewinded) + + + Plays forward all tweens and returns the number of actual tweens played + (meaning tweens that were not already playing forward or complete) + + + Plays forward all tweens with the given ID or target and returns the number of actual tweens played + (meaning the tweens that were not already playing forward or complete) + + + Plays forward all tweens with the given target and ID and returns the number of actual tweens played + (meaning the tweens that were not already started, playing backwards or rewinded) + + + Restarts all tweens, then returns the number of actual tweens restarted + + + Restarts all tweens with the given ID or target, then returns the number of actual tweens restarted + If TRUE includes the eventual tweens delays, otherwise skips them + If >= 0 changes the startup delay of all involved tweens to this value, otherwise doesn't touch it + + + Restarts all tweens with the given target and the given ID, and returns the number of actual tweens played + (meaning the tweens that were not already playing or complete) + If TRUE includes the eventual tweens delays, otherwise skips them + If >= 0 changes the startup delay of all involved tweens to this value, otherwise doesn't touch it + + + Rewinds and pauses all tweens, then returns the number of actual tweens rewinded + (meaning tweens that were not already rewinded) + + + Rewinds and pauses all tweens with the given ID or target, then returns the number of actual tweens rewinded + (meaning the tweens that were not already rewinded) + + + Smoothly rewinds all tweens (delays excluded), then returns the number of actual tweens rewinding/rewinded + (meaning tweens that were not already rewinded). + A "smooth rewind" animates the tween to its start position, + skipping all elapsed loops (except in case of LoopType.Incremental) while keeping the animation fluent. + Note that a tween that was smoothly rewinded will have its play direction flipped + + + Smoothly rewinds all tweens (delays excluded) with the given ID or target, then returns the number of actual tweens rewinding/rewinded + (meaning the tweens that were not already rewinded). + A "smooth rewind" animates the tween to its start position, + skipping all elapsed loops (except in case of LoopType.Incremental) while keeping the animation fluent. + Note that a tween that was smoothly rewinded will have its play direction flipped + + + Toggles the play state of all tweens and returns the number of actual tweens toggled + (meaning tweens that could be played or paused, depending on the toggle state) + + + Toggles the play state of all tweens with the given ID or target and returns the number of actual tweens toggled + (meaning the tweens that could be played or paused, depending on the toggle state) + + + + Returns TRUE if a tween with the given ID or target is active. + You can also use this to know if a shortcut tween is active for a given target. + Example: + transform.DOMoveX(45, 1); // transform is automatically added as the tween target + DOTween.IsTweening(transform); // Returns true + + The target or ID to look for + If FALSE (default) returns TRUE as long as a tween for the given target/ID is active, + otherwise also requires it to be playing + + + + Returns the total number of active tweens (so both Tweeners and Sequences). + A tween is considered active if it wasn't killed, regardless if it's playing or paused + + + + + Returns the total number of active Tweeners. + A Tweener is considered active if it wasn't killed, regardless if it's playing or paused + + + + + Returns the total number of active Sequences. + A Sequence is considered active if it wasn't killed, regardless if it's playing or paused + + + + + Returns the total number of active and playing tweens. + A tween is considered as playing even if its delay is actually playing + + + + + Returns a the total number of active tweens with the given id. + + If TRUE returns only the tweens with the given ID that are currently playing + + + + Returns a list of all active tweens in a playing state. + Returns NULL if there are no active playing tweens. + Beware: each time you call this method a new list is generated, so use it for debug only + + If NULL creates a new list, otherwise clears and fills this one (and thus saves allocations) + + + + Returns a list of all active tweens in a paused state. + Returns NULL if there are no active paused tweens. + Beware: each time you call this method a new list is generated, so use it for debug only + + If NULL creates a new list, otherwise clears and fills this one (and thus saves allocations) + + + + Returns a list of all active tweens with the given id. + Returns NULL if there are no active tweens with the given id. + Beware: each time you call this method a new list is generated + + If TRUE returns only the tweens with the given ID that are currently playing + If NULL creates a new list, otherwise clears and fills this one (and thus saves allocations) + + + + Returns a list of all active tweens with the given target. + Returns NULL if there are no active tweens with the given target. + Beware: each time you call this method a new list is generated + If TRUE returns only the tweens with the given target that are currently playing + If NULL creates a new list, otherwise clears and fills this one (and thus saves allocations) + + + + + Creates virtual tweens that can be used to change other elements via their OnUpdate calls + + + + + Tweens a virtual float. + You can add regular settings to the generated tween, + but do not use OnUpdate or you will overwrite the onVirtualUpdate parameter + + The value to start from + The value to tween to + The duration of the tween + A callback which must accept a parameter of type float, called at each update + + + + Tweens a virtual int. + You can add regular settings to the generated tween, + but do not use OnUpdate or you will overwrite the onVirtualUpdate parameter + + The value to start from + The value to tween to + The duration of the tween + A callback which must accept a parameter of type int, called at each update + + + + Tweens a virtual Vector2. + You can add regular settings to the generated tween, + but do not use OnUpdate or you will overwrite the onVirtualUpdate parameter + + The value to start from + The value to tween to + The duration of the tween + A callback which must accept a parameter of type Vector3, called at each update + + + + Tweens a virtual Vector3. + You can add regular settings to the generated tween, + but do not use OnUpdate or you will overwrite the onVirtualUpdate parameter + + The value to start from + The value to tween to + The duration of the tween + A callback which must accept a parameter of type Vector3, called at each update + + + + Tweens a virtual Color. + You can add regular settings to the generated tween, + but do not use OnUpdate or you will overwrite the onVirtualUpdate parameter + + The value to start from + The value to tween to + The duration of the tween + A callback which must accept a parameter of type Color, called at each update + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + Eventual overshoot to use with Back ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + Eventual amplitude to use with Elastic easeType + Eventual period to use with Elastic easeType + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The AnimationCurve to use for ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + Eventual overshoot to use with Back ease + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The type of ease + Eventual amplitude to use with Elastic easeType + Eventual period to use with Elastic easeType + + + Returns a value based on the given ease and lifetime percentage (0 to 1) + The value to start from when lifetimePercentage is 0 + The value to reach when lifetimePercentage is 1 + The time percentage (0 to 1) at which the value should be taken + The AnimationCurve to use for ease + + + Fires the given callback after the given time. + Callback delay + Callback to fire when the delay has expired + If TRUE (default) ignores Unity's timeScale + + + + Don't assign this! It's assigned automatically when creating 0 duration tweens + + + + + Don't assign this! It's assigned automatically when setting the ease to an AnimationCurve or to a custom ease function + + + + + Allows to wrap ease method in special ways, adding extra features + + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + Ease type + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + AnimationCurve to use for the ease + + + + Converts the given ease so that it also creates a stop-motion effect, by playing the tween at the given FPS + + FPS at which the tween should be played + Custom ease function to use + + + + Used to allow method chaining with DOTween.Init + + + + + Directly sets the current max capacity of Tweeners and Sequences + (meaning how many Tweeners and Sequences can be running at the same time), + so that DOTween doesn't need to automatically increase them in case the max is reached + (which might lead to hiccups when that happens). + Sequences capacity must be less or equal to Tweeners capacity + (if you pass a low Tweener capacity it will be automatically increased to match the Sequence's). + Beware: use this method only when there are no tweens running. + + Max Tweeners capacity. + Default: 200 + Max Sequences capacity. + Default: 50 + + + + Behaviour that can be assigned when chaining a SetLink to a tween + + + + Pauses the tween when the link target is disabled + + + Pauses the tween when the link target is disabled, plays it when it's enabled + + + Pauses the tween when the link target is disabled, restarts it when it's enabled + + + Plays the tween when the link target is enabled + + + Restarts the tween when the link target is enabled + + + Kills the tween when the link target is disabled + + + Kills the tween when the link target is destroyed (becomes NULL). This is always active even if another behaviour is chosen + + + Completes the tween when the link target is disabled + + + Completes and kills the tween when the link target is disabled + + + Rewinds the tween (delay excluded) when the link target is disabled + + + Rewinds and kills the tween when the link target is disabled + + + + Path mode (used to determine correct LookAt orientation) + + + + Ignores the path mode (and thus LookAt behaviour) + + + Regular 3D path + + + 2D top-down path + + + 2D side-scroller path + + + + Type of path to use with DOPath tweens + + + + Linear, composed of straight segments between each waypoint + + + Curved path (which uses Catmull-Rom curves) + + + EXPERIMENTAL: Curved path (which uses Cubic Bezier curves, where each point requires two extra control points) + + + + Tweens a Vector2 along a circle. + EndValue represents the center of the circle, start and end value degrees are inside options + ChangeValue x is changeValue°, y is unused + + + + + Path control point + + + + + Path waypoints (modified by PathPlugin when setting relative end/change value or by CubicBezierDecoder) and by DOTweenPathInspector + + + + + Minimum input points necessary to create the path (doesn't correspond to actual waypoints required) + + + + + Gets the point on the path at the given percentage (0 to 1) + + The percentage (0 to 1) at which to get the point + If TRUE constant speed is taken into account, otherwise not + + + + Base interface for all tween plugins options + + + + Resets the plugin + + + + This plugin generates some GC allocations at startup + + + + + Path plugin works exclusively with Transforms + + + + + Rotation mode used with DORotate methods + + + + + Fastest way that never rotates beyond 360° + + + + + Fastest way that rotates beyond 360° + + + + + Adds the given rotation to the transform using world axis and an advanced precision mode + (like when using transform.Rotate(Space.World)). + In this mode the end value is is always considered relative + + + + + Adds the given rotation to the transform's local axis + (like when rotating an object with the "local" switch enabled in Unity's editor or using transform.Rotate(Space.Self)). + In this mode the end value is is always considered relative + + + + + Type of scramble to apply to string tweens + + + + + No scrambling of characters + + + + + A-Z + a-z + 0-9 characters + + + + + A-Z characters + + + + + a-z characters + + + + + 0-9 characters + + + + + Custom characters + + + + + Type of randomness to apply to a shake tween + + + + Default, full randomness + + + Creates a more balanced randomness that looks more harmonic + + + + Methods that extend Tween objects and allow to control or get data from them + + + + Completes the tween + + + Completes the tween + For Sequences only: if TRUE also internal Sequence callbacks will be fired, + otherwise they will be ignored + + + Optional: indicates that the tween creation has ended, to be used (optionally) as the last element of tween chaining creation.
+ This method won't do anything except in case of 0-duration tweens, + where it will complete them immediately instead of waiting for the next internal update routine + (unless they're nested in a Sequence, in which case the Sequence will still be the one in control and this method will be ignored)
+
+ + Flips the direction of this tween (backwards if it was going forward or viceversa) + + + Forces the tween to initialize its settings immediately + + + Send the tween to the given position in time + Time position to reach + (if higher than the whole tween duration the tween will simply reach its end) + If TRUE will play the tween after reaching the given position, otherwise it will pause it + + + Send the tween to the given position in time while also executing any callback between the previous time position and the new one + Time position to reach + (if higher than the whole tween duration the tween will simply reach its end) + If TRUE will play the tween after reaching the given position, otherwise it will pause it + + + Kills the tween + If TRUE completes the tween before killing it + + + + Forces this tween to update manually, regardless of the set via SetUpdate. + Note that the tween will still be subject to normal tween rules, so if for example it's paused this method will do nothing. + Also note that if you only want to update this tween instance manually you'll have to set it to anyway, + so that it's not updated automatically. + + Manual deltaTime + Unscaled delta time (used with tweens set as timeScaleIndependent) + + + Pauses the tween + + + Plays the tween + + + Sets the tween in a backwards direction and plays it + + + Sets the tween in a forward direction and plays it + + + Restarts the tween from the beginning + Ignored in case of Sequences. If TRUE includes the eventual tween delay, otherwise skips it + Ignored in case of Sequences. If >= 0 changes the startup delay to this value, otherwise doesn't touch it + + + Rewinds and pauses the tween + Ignored in case of Sequences. If TRUE includes the eventual tween delay, otherwise skips it + + + Smoothly rewinds the tween (delays excluded). + A "smooth rewind" animates the tween to its start position, + skipping all elapsed loops (except in case of LoopType.Incremental) while keeping the animation fluent. + If called on a tween who is still waiting for its delay to happen, it will simply set the delay to 0 and pause the tween. + Note that a tween that was smoothly rewinded will have its play direction flipped + + + Plays the tween if it was paused, pauses it if it was playing + + + Send a path tween to the given waypoint. + Has no effect if this is not a path tween. + BEWARE, this is a special utility method: + it works only with Linear eases. Also, the lookAt direction might be wrong after calling this and might need to be set manually + (because it relies on a smooth path movement and doesn't work well with jumps that encompass dramatic direction changes) + Waypoint index to reach + (if higher than the max waypoint index the tween will simply go to the last one) + If TRUE will play the tween after reaching the given waypoint, otherwise it will pause it + + + + Creates a yield instruction that waits until the tween is killed or complete. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForCompletion(); + + + + + Creates a yield instruction that waits until the tween is killed or rewinded. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForRewind(); + + + + + Creates a yield instruction that waits until the tween is killed. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForKill(); + + + + + Creates a yield instruction that waits until the tween is killed or has gone through the given amount of loops. + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForElapsedLoops(2); + + Elapsed loops to wait for + + + + Creates a yield instruction that waits until the tween is killed or has reached the given position (loops included, delays excluded). + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForPosition(2.5f); + + Position (loops included, delays excluded) to wait for + + + + Creates a yield instruction that waits until the tween is killed or started + (meaning when the tween is set in a playing state the first time, after any eventual delay). + It can be used inside a coroutine as a yield. + Example usage:yield return myTween.WaitForStart(); + + + + Returns the total number of loops completed by this tween + + + Returns the eventual delay set for this tween + + + Returns the eventual elapsed delay set for this tween + + + Returns the duration of this tween (delays excluded). + NOTE: when using settings like SpeedBased, the duration will be recalculated when the tween starts + If TRUE returns the full duration loops included, + otherwise the duration of a single loop cycle + + + Returns the elapsed time for this tween (delays exluded) + If TRUE returns the elapsed time since startup loops included, + otherwise the elapsed time within the current loop cycle + + + Returns the elapsed percentage (0 to 1) of this tween (delays exluded) + If TRUE returns the elapsed percentage since startup loops included, + otherwise the elapsed percentage within the current loop cycle + + + Returns the elapsed percentage (0 to 1) of this tween (delays exluded), + based on a single loop, and calculating eventual backwards Yoyo loops as 1 to 0 instead of 0 to 1 + + + Returns FALSE if this tween has been killed or is NULL, TRUE otherwise. + BEWARE: if this tween is recyclable it might have been spawned again for another use and thus return TRUE anyway. + When working with recyclable tweens you should take care to know when a tween has been killed and manually set your references to NULL. + If you want to be sure your references are set to NULL when a tween is killed you can use the OnKill callback like this: + .OnKill(()=> myTweenReference = null) + + + Returns TRUE if this tween was reversed and is set to go backwards + + + NOTE: To check if a tween was simply set to go backwards see . + Returns TRUE if this tween is going backwards for any of these reasons: + - The tween was reversed and is going backwards on a straight loop + - The tween was reversed and is going backwards on an odd Yoyo loop + - The tween is going forward but on an even Yoyo loop + IMPORTANT: if used inside a tween's callback, this will return a result concerning the exact frame when it's asked, + so for example in a callback at the end of a Yoyo loop step this method will never return FALSE + because the frame will never end exactly there and the tween will already be going backwards when the callback is fired + + + Returns TRUE if the tween is complete + (silently fails and returns FALSE if the tween has been killed) + + + Returns TRUE if this tween was set to be timeScale independent via the tween.SetUpdate method + + + Returns TRUE if this tween has been initialized + + + Returns TRUE if this tween is playing + + + Returns the total number of loops set for this tween + (returns -1 if the loops are infinite) + + + + Returns a point on a path based on the given path percentage. + Returns Vector3.zero if this is not a path tween, if the tween is invalid, or if the path is not yet initialized. + A path is initialized after its tween starts, or immediately if the tween was created with the Path Editor (DOTween Pro feature). + You can force a path to be initialized by calling myTween.ForceInit(). + + Percentage of the path (0 to 1) on which to get the point + + + + Returns an array of points that can be used to draw the path. + Note that this method generates allocations, because it creates a new array. + Returns NULL if this is not a path tween, if the tween is invalid, or if the path is not yet initialized. + A path is initialized after its tween starts, or immediately if the tween was created with the Path Editor (DOTween Pro feature). + You can force a path to be initialized by calling myTween.ForceInit(). + + How many points to create for each path segment (waypoint to waypoint). + Only used in case of non-Linear paths + + + + Returns the length of a path. + Returns -1 if this is not a path tween, if the tween is invalid, or if the path is not yet initialized. + A path is initialized after its tween starts, or immediately if the tween was created with the Path Editor (DOTween Pro feature). + You can force a path to be initialized by calling myTween.ForceInit(). + + + + + Types of loop + + + + Each loop cycle restarts from the beginning + + + The tween moves forward and backwards at alternate cycles + + + Continuously increments the tween at the end of each loop cycle (A to B, B to B+(A-B), and so on), thus always moving "onward". + In case of String tweens works only if the tween is set as relative + + + + Controls other tweens as a group + + + + + Methods that extend known Unity objects and allow to directly create and control tweens from their instances + + + + Tweens a Camera's aspect to the given value. + Also stores the camera as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Camera's backgroundColor to the given value. + Also stores the camera as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Camera's farClipPlane to the given value. + Also stores the camera as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Camera's fieldOfView to the given value. + Also stores the camera as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Camera's nearClipPlane to the given value. + Also stores the camera as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Camera's orthographicSize to the given value. + Also stores the camera as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Camera's pixelRect to the given value. + Also stores the camera as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Camera's rect to the given value. + Also stores the camera as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Shakes a Camera's localPosition along its relative X Y axes with the given values. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + Randomness mode + + + Shakes a Camera's localPosition along its relative X Y axes with the given values. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + Randomness mode + + + Shakes a Camera's localRotation. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + Randomness mode + + + Shakes a Camera's localRotation. + Also stores the camera as the tween's target so it can be used for filtered operations + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + Randomness mode + + + Tweens a Light's color to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's intensity to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's shadowStrength to the given value. + Also stores the light as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a LineRenderer's color to the given value. + Also stores the LineRenderer as the tween's target so it can be used for filtered operations. + Note that this method requires to also insert the start colors for the tween, + since LineRenderers have no way to get them. + The start value to tween from + The end value to reachThe duration of the tween + + + Tweens a Material's color to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's named color property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween (like _Tint or _SpecColor) + The duration of the tween + + + Tweens a Material's named color property with the given ID to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The ID of the material property to tween (also called nameID in Unity's manual) + The duration of the tween + + + Tweens a Material's alpha color to the given value + (will have no effect unless your material supports transparency). + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Material's alpha color to the given value + (will have no effect unless your material supports transparency). + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween (like _Tint or _SpecColor) + The duration of the tween + + + Tweens a Material's alpha color with the given ID to the given value + (will have no effect unless your material supports transparency). + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The ID of the material property to tween (also called nameID in Unity's manual) + The duration of the tween + + + Tweens a Material's named float property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween + The duration of the tween + + + Tweens a Material's named float property with the given ID to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The ID of the material property to tween (also called nameID in Unity's manual) + The duration of the tween + + + Tweens a Material's texture offset to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The duration of the tween + + + Tweens a Material's named texture offset property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween + The duration of the tween + + + Tweens a Material's texture scale to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The duration of the tween + + + Tweens a Material's named texture scale property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween + The duration of the tween + + + Tweens a Material's named Vector property to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The name of the material property to tween + The duration of the tween + + + Tweens a Material's named Vector property with the given ID to the given value. + Also stores the material as the tween's target so it can be used for filtered operations + The end value to reach + The ID of the material property to tween (also called nameID in Unity's manual) + The duration of the tween + + + Tweens a TrailRenderer's startWidth/endWidth to the given value. + Also stores the TrailRenderer as the tween's target so it can be used for filtered operations + The end startWidth to reachThe end endWidth to reach + The duration of the tween + + + Tweens a TrailRenderer's time to the given value. + Also stores the TrailRenderer as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's X position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Y position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Z position to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's X localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Y localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's Z localPosition to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's rotation to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Transform's rotation to the given value using pure quaternion values. + Also stores the transform as the tween's target so it can be used for filtered operations. + PLEASE NOTE: DORotate, which takes Vector3 values, is the preferred rotation method. + This method was implemented for very special cases, and doesn't support LoopType.Incremental loops + (neither for itself nor if placed inside a LoopType.Incremental Sequence) + + The end value to reachThe duration of the tween + + + Tweens a Transform's localRotation to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + Rotation mode + + + Tweens a Transform's rotation to the given value using pure quaternion values. + Also stores the transform as the tween's target so it can be used for filtered operations. + PLEASE NOTE: DOLocalRotate, which takes Vector3 values, is the preferred rotation method. + This method was implemented for very special cases, and doesn't support LoopType.Incremental loops + (neither for itself nor if placed inside a LoopType.Incremental Sequence) + + The end value to reachThe duration of the tween + + + Tweens a Transform's localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's localScale uniformly to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's X localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's Y localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's Z localScale to the given value. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Transform's rotation so that it will look towards the given world position. + Also stores the transform as the tween's target so it can be used for filtered operations + The position to look atThe duration of the tween + Eventual axis constraint for the rotation + The vector that defines in which direction up is (default: Vector3.up) + + + EXPERIMENTAL Tweens a Transform's rotation so that it will look towards the given world position, + while also updating the lookAt position every frame + (contrary to which calculates the lookAt rotation only once, when the tween starts). + Also stores the transform as the tween's target so it can be used for filtered operations + The position to look atThe duration of the tween + Eventual axis constraint for the rotation + The vector that defines in which direction up is (default: Vector3.up) + + + Punches a Transform's localPosition towards the given direction and then back to the starting one + as if it was connected to the starting position via an elastic. + The direction and strength of the punch (added to the Transform's current position) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + 1 creates a full oscillation between the punch direction and the opposite direction, + while 0 oscillates only between the punch and the start position + If TRUE the tween will smoothly snap all values to integers + + + Punches a Transform's localScale towards the given size and then back to the starting one + as if it was connected to the starting scale via an elastic. + The punch strength (added to the Transform's current scale) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting size when bouncing backwards. + 1 creates a full oscillation between the punch scale and the opposite scale, + while 0 oscillates only between the punch scale and the start scale + + + Punches a Transform's localRotation towards the given size and then back to the starting one + as if it was connected to the starting rotation via an elastic. + The punch strength (added to the Transform's current rotation) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting rotation when bouncing backwards. + 1 creates a full oscillation between the punch rotation and the opposite rotation, + while 0 oscillates only between the punch and the start rotation + + + Shakes a Transform's localPosition with the given values. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the tween will smoothly snap all values to integers + If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + Randomness mode + + + Shakes a Transform's localPosition with the given values. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the tween will smoothly snap all values to integers + If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + Randomness mode + + + Shakes a Transform's localRotation. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + Randomness mode + + + Shakes a Transform's localRotation. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + Randomness mode + + + Shakes a Transform's localScale. + The duration of the tween + The shake strength + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + Randomness mode + + + Shakes a Transform's localScale. + The duration of the tween + The shake strength on each axis + Indicates how much will the shake vibrate + Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + Setting it to 0 will shake along a single direction. + If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + Randomness mode + + + Tweens a Transform's position to the given value, while also applying a jump effect along the Y axis. + Returns a Sequence instead of a Tweener. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reach + Power of the jump (the max height of the jump is represented by this plus the final Y offset) + Total number of jumps + The duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's localPosition to the given value, while also applying a jump effect along the Y axis. + Returns a Sequence instead of a Tweener. + Also stores the transform as the tween's target so it can be used for filtered operations + The end value to reach + Power of the jump (the max height of the jump is represented by this plus the final Y offset) + Total number of jumps + The duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's position through the given path waypoints, using the chosen path algorithm. + Also stores the transform as the tween's target so it can be used for filtered operations + The waypoints to go through + The duration of the tween + The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points) + The path mode: 3D, side-scroller 2D, top-down 2D + The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive. + Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + The color of the path (shown when gizmos are active in the Play panel and the tween is running) + + + Tweens a Transform's localPosition through the given path waypoints, using the chosen path algorithm. + Also stores the transform as the tween's target so it can be used for filtered operations + The waypoint to go through + The duration of the tween + The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points) + The path mode: 3D, side-scroller 2D, top-down 2D + The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive. + Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + The color of the path (shown when gizmos are active in the Play panel and the tween is running) + + + IMPORTANT: Unless you really know what you're doing, you should use the overload that accepts a Vector3 array instead. + Tweens a Transform's position via the given path. + Also stores the transform as the tween's target so it can be used for filtered operations + The path to use + The duration of the tween + The path mode: 3D, side-scroller 2D, top-down 2D + + + IMPORTANT: Unless you really know what you're doing, you should use the overload that accepts a Vector3 array instead. + Tweens a Transform's localPosition via the given path. + Also stores the transform as the tween's target so it can be used for filtered operations + The path to use + The duration of the tween + The path mode: 3D, side-scroller 2D, top-down 2D + + + Tweens a Tween's timeScale to the given value. + Also stores the Tween as the tween's target so it can be used for filtered operations + The end value to reachThe duration of the tween + + + Tweens a Light's color to the given value, + in a way that allows other DOBlendableColor tweens to work together on the same target, + instead than fight each other as multiple DOColor would do. + Also stores the Light as the tween's target so it can be used for filtered operations + The value to tween toThe duration of the tween + + + Tweens a Material's color to the given value, + in a way that allows other DOBlendableColor tweens to work together on the same target, + instead than fight each other as multiple DOColor would do. + Also stores the Material as the tween's target so it can be used for filtered operations + The value to tween toThe duration of the tween + + + Tweens a Material's named color property to the given value, + in a way that allows other DOBlendableColor tweens to work together on the same target, + instead than fight each other as multiple DOColor would do. + Also stores the Material as the tween's target so it can be used for filtered operations + The value to tween to + The name of the material property to tween (like _Tint or _SpecColor) + The duration of the tween + + + Tweens a Material's named color property with the given ID to the given value, + in a way that allows other DOBlendableColor tweens to work together on the same target, + instead than fight each other as multiple DOColor would do. + Also stores the Material as the tween's target so it can be used for filtered operations + The value to tween to + The ID of the material property to tween (also called nameID in Unity's manual) + The duration of the tween + + + Tweens a Transform's position BY the given value (as if you chained a SetRelative), + in a way that allows other DOBlendableMove tweens to work together on the same target, + instead than fight each other as multiple DOMove would do. + Also stores the transform as the tween's target so it can be used for filtered operations + The value to tween byThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + Tweens a Transform's localPosition BY the given value (as if you chained a SetRelative), + in a way that allows other DOBlendableMove tweens to work together on the same target, + instead than fight each other as multiple DOMove would do. + Also stores the transform as the tween's target so it can be used for filtered operations + The value to tween byThe duration of the tween + If TRUE the tween will smoothly snap all values to integers + + + EXPERIMENTAL METHOD - Tweens a Transform's rotation BY the given value (as if you chained a SetRelative), + in a way that allows other DOBlendableRotate tweens to work together on the same target, + instead than fight each other as multiple DORotate would do. + Also stores the transform as the tween's target so it can be used for filtered operations + The value to tween byThe duration of the tween + Rotation mode + + + EXPERIMENTAL METHOD - Tweens a Transform's lcoalRotation BY the given value (as if you chained a SetRelative), + in a way that allows other DOBlendableRotate tweens to work together on the same target, + instead than fight each other as multiple DORotate would do. + Also stores the transform as the tween's target so it can be used for filtered operations + The value to tween byThe duration of the tween + Rotation mode + + + Punches a Transform's localRotation BY the given value and then back to the starting one + as if it was connected to the starting rotation via an elastic. Does it in a way that allows other + DOBlendableRotate tweens to work together on the same target + The punch strength (added to the Transform's current rotation) + The duration of the tween + Indicates how much will the punch vibrate + Represents how much (0 to 1) the vector will go beyond the starting rotation when bouncing backwards. + 1 creates a full oscillation between the punch rotation and the opposite rotation, + while 0 oscillates only between the punch and the start rotation + + + Tweens a Transform's localScale BY the given value (as if you chained a SetRelative), + in a way that allows other DOBlendableScale tweens to work together on the same target, + instead than fight each other as multiple DOScale would do. + Also stores the transform as the tween's target so it can be used for filtered operations + The value to tween byThe duration of the tween + + + + Completes all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens completed + (meaning the tweens that don't have infinite loops and were not already complete) + + For Sequences only: if TRUE also internal Sequence callbacks will be fired, + otherwise they will be ignored + + + + Completes all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens completed + (meaning the tweens that don't have infinite loops and were not already complete) + + For Sequences only: if TRUE also internal Sequence callbacks will be fired, + otherwise they will be ignored + + + + Kills all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens killed. + + If TRUE completes the tween before killing it + + + + Kills all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens killed. + + If TRUE completes the tween before killing it + + + + Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens flipped. + + + + + Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens flipped. + + + + + Sends to the given position all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens involved. + + Time position to reach + (if higher than the whole tween duration the tween will simply reach its end) + If TRUE will play the tween after reaching the given position, otherwise it will pause it + + + + Sends to the given position all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens involved. + + Time position to reach + (if higher than the whole tween duration the tween will simply reach its end) + If TRUE will play the tween after reaching the given position, otherwise it will pause it + + + + Pauses all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens paused. + + + + + Pauses all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens paused. + + + + + Plays all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays backwards all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays backwards all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays forward all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Plays forward all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens played. + + + + + Restarts all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens restarted. + + + + + Restarts all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens restarted. + + + + + Rewinds all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens rewinded. + + + + + Rewinds all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens rewinded. + + + + + Smoothly rewinds all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens rewinded. + + + + + Smoothly rewinds all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens rewinded. + + + + + Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens involved. + + + + + Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference + (meaning tweens that were started from this target, or that had this target added as an Id) + and returns the total number of tweens involved. + + + + + This class serves only as a utility class to store tween settings to apply on multiple tweens. + It is in no way needed otherwise, since you can directly apply tween settings to a tween via chaining + + + + A variable you can eventually Clear and reuse when needed, + to avoid instantiating TweenParams objects + + + Creates a new TweenParams object, which you can use to store tween settings + to pass to multiple tweens via myTween.SetAs(myTweenParms) + + + Clears and resets this TweenParams instance using default values, + so it can be reused without instantiating another one + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started + If TRUE the tween will be automatically killed when complete + + + Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + The ID to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + The ID to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets an ID for the tween, which can then be used as a filter with DOTween's static methods. + The ID to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the target for the tween, which can then be used as a filter with DOTween's static methods. + IMPORTANT: use it with caution. If you just want to set an ID for the tween use SetId instead. + When using shorcuts the shortcut target is already assigned as the tween's target, + so using this method will overwrite it and prevent shortcut-operations like myTarget.DOPause from working correctly. + The target to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + Loop behaviour type (default: LoopType.Restart) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual overshoot or amplitude to use with Back or Elastic easeType (default is 1.70158) + Eventual period to use with Elastic easeType (default is 0) + + + Sets the ease of the tween using an AnimationCurve. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween using a custom ease function. + If applied to Sequences eases the whole sequence animation + + + Sets the recycling behaviour for the tween. + If TRUE the tween will be recycled after being killed, otherwise it will be destroyed. + + + Sets the update type to the one defined in DOTween.defaultUpdateType (UpdateType.Normal unless changed) + and lets you choose if it should be independent from Unity's Time.timeScale + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the type of update (default or independent) for the tween + The type of update (default: UpdateType.Normal) + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the onStart callback for the tween. + Called the first time the tween is set in a playing state, after any eventual delay + + + Sets the onPlay callback for the tween. + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Sets the onRewind callback for the tween. + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Sets the onUpdate callback for the tween. + Called each time the tween updates + + + Sets the onStepComplete callback for the tween. + Called the moment the tween completes one loop cycle, even when going backwards + + + Sets the onComplete callback for the tween. + Called the moment the tween reaches its final forward position, loops included + + + Sets the onKill callback for the tween. + Called the moment the tween is killed + + + Sets the onWaypointChange callback for the tween. + Called when a path tween reaches a new waypoint + + + Sets a delayed startup for the tween. + Has no effect on Sequences or if the tween has already started + + + If isRelative is TRUE sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + + Methods that extend Tween objects and allow to set their parameters + + + + Sets the autoKill behaviour of the tween to TRUE. + Has no effect if the tween has already started or if it's added to a Sequence + + + Sets the autoKill behaviour of the tween. + Has no effect if the tween has already started or if it's added to a Sequence + If TRUE the tween will be automatically killed when complete + + + Sets an ID for the tween (), which can then be used as a filter with DOTween's static methods. + The ID to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets a string ID for the tween (), which can then be used as a filter with DOTween's static methods. + Filtering via string is 2X faster than using an object as an ID (using the alternate obejct overload) + The string ID to assign to this tween. + + + Sets an int ID for the tween (), which can then be used as a filter with DOTween's static methods. + Filtering via int is 4X faster than via object, 2X faster than via string (using the alternate object/string overloads) + The int ID to assign to this tween. + + + Allows to link this tween to a GameObject + so that it will be automatically killed when the GameObject is destroyed. + Has no effect if the tween is added to a Sequence + The link target (unrelated to the target set via SetTarget) + + + Allows to link this tween to a GameObject and assign a behaviour depending on it. + This will also automatically kill the tween when the GameObject is destroyed. + Has no effect if the tween is added to a Sequence + The link target (unrelated to the target set via SetTarget) + The behaviour to use ( is always evaluated even if you choose another one) + + + Sets the target for the tween, which can then be used as a filter with DOTween's static methods. + IMPORTANT: use it with caution. If you just want to set an ID for the tween use SetId instead. + When using shorcuts the shortcut target is already assigned as the tween's target, + so using this method will overwrite it and prevent shortcut-operations like myTarget.DOPause from working correctly. + The target to assign to this tween. Can be an int, a string, an object or anything else. + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + + + Sets the looping options for the tween. + Has no effect if the tween has already started + Number of cycles to play (-1 for infinite - will be converted to 1 in case the tween is nested in a Sequence) + Loop behaviour type (default: LoopType.Restart) + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + + Eventual overshoot to use with Back or Flash ease (default is 1.70158 - 1 for Flash). + In case of Flash ease it must be an intenger and sets the total number of flashes that will happen. + Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value. + + + + Sets the ease of the tween. + If applied to Sequences eases the whole sequence animation + Eventual amplitude to use with Elastic easeType or overshoot to use with Flash easeType (default is 1.70158 - 1 for Flash). + In case of Flash ease it must be an integer and sets the total number of flashes that will happen. + Using an even number will complete the tween on the starting value, while an odd one will complete it on the end value. + + Eventual period to use with Elastic or Flash easeType (default is 0). + In case of Flash ease it indicates the power in time of the ease, and must be between -1 and 1. + 0 is balanced, 1 weakens the ease with time, -1 starts the ease weakened and gives it power towards the end. + + + + Sets the ease of the tween using an AnimationCurve. + If applied to Sequences eases the whole sequence animation + + + Sets the ease of the tween using a custom ease function (which must return a value between 0 and 1). + If applied to Sequences eases the whole sequence animation + + + Allows the tween to be recycled after being killed. + + + Sets the recycling behaviour for the tween. + If TRUE the tween will be recycled after being killed, otherwise it will be destroyed. + + + Sets the update type to UpdateType.Normal and lets you choose if it should be independent from Unity's Time.timeScale + If TRUE the tween will ignore Unity's Time.timeScale + + + Sets the type of update for the tween + The type of update (defalt: UpdateType.Normal) + + + Sets the type of update for the tween and lets you choose if it should be independent from Unity's Time.timeScale + The type of update + If TRUE the tween will ignore Unity's Time.timeScale + + + EXPERIMENTAL: inverts this tween, so that it will play from the end to the beginning + (playing it backwards will actually play it from the beginning to the end). + Has no effect if the tween has already started or if it's added to a Sequence + + + EXPERIMENTAL: inverts this tween, so that it will play from the end to the beginning + (playing it backwards will actually play it from the beginning to the end). + Has no effect if the tween has already started or if it's added to a Sequence + If TRUE the tween will be inverted, otherwise it won't + + + Sets the onStart callback for the tween, clearing any previous onStart callback that was set. + Called the first time the tween is set in a playing state, after any eventual delay + + + Sets the onPlay callback for the tween, clearing any previous onPlay callback that was set. + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Sets the onPause callback for the tween, clearing any previous onPause callback that was set. + Called when the tween state changes from playing to paused. + If the tween has autoKill set to FALSE, this is called also when the tween reaches completion. + + + Sets the onRewind callback for the tween, clearing any previous onRewind callback that was set. + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Sets the onUpdate callback for the tween, clearing any previous onUpdate callback that was set. + Called each time the tween updates + + + Sets the onStepComplete callback for the tween, clearing any previous onStepComplete callback that was set. + Called the moment the tween completes one loop cycle, even when going backwards + + + Sets the onComplete callback for the tween, clearing any previous onComplete callback that was set. + Called the moment the tween reaches its final forward position, loops included + + + Sets the onKill callback for the tween, clearing any previous onKill callback that was set. + Called the moment the tween is killed + + + Sets the onWaypointChange callback for the tween, clearing any previous onWaypointChange callback that was set. + Called when a path tween's current waypoint changes + + + Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given one. + Doesn't copy specific SetOptions settings: those will need to be applied manually each time. + Has no effect if the tween has already started. + NOTE: the tween's target will not be changed + Tween from which to copy the parameters + + + Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given TweenParams. + Has no effect if the tween has already started. + TweenParams from which to copy the parameters + + + Adds the given tween to the end of the Sequence. + Has no effect if the Sequence has already started + The tween to append + + + Adds the given tween to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The tween to prepend + + + Inserts the given tween at the same time position of the last tween, callback or interval added to the Sequence. + Note that, in case of a Join after an interval, the insertion time will be the time where the interval starts, not where it finishes. + Has no effect if the Sequence has already started + + + Inserts the given tween at the given time position in the Sequence, + automatically adding an interval if needed. + Has no effect if the Sequence has already started + The time position where the tween will be placed + The tween to insert + + + Adds the given interval to the end of the Sequence. + Has no effect if the Sequence has already started + The interval duration + + + Adds the given interval to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The interval duration + + + Adds the given callback to the end of the Sequence. + Has no effect if the Sequence has already started + The callback to append + + + Adds the given callback to the beginning of the Sequence, pushing forward the other nested content. + Has no effect if the Sequence has already started + The callback to prepend + + + Inserts the given callback at the same time position of the last tween, callback or interval added to the Sequence. + Note that, in case of a Join after an interval, the insertion time will be the time where the interval starts, not where it finishes. + Has no effect if the Sequence has already started + /// <param name="callback">The callback to prepend</param> + + + Inserts the given callback at the given time position in the Sequence, + automatically adding an interval if needed. + Has no effect if the Sequence has already started + The time position where the callback will be placed + The callback to insert + + + Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue + then immediately sends the target to the previously set endValue. + + + Changes a TO tween into a FROM tween: sets the current target's position as the tween's endValue + then immediately sends the target to the previously set endValue. + If TRUE the FROM value will be calculated as relative to the current one + + + Changes a TO tween into a FROM tween: sets the current value of the target as the endValue, + and the previously passed endValue as the actual startValue. + If TRUE sets the target to from value immediately, otherwise waits for the tween to start + If TRUE the FROM value will be calculated as relative to the current one + + + Changes a TO tween into a FROM tween: sets the tween's starting value to the given one + and eventually sets the tween's target to that value immediately. + Value to start from + If TRUE sets the target to from value immediately, otherwise waits for the tween to start + If TRUE the FROM/TO values will be calculated as relative to the current ones + + + Changes a TO tween into a FROM tween: sets the tween's starting value to the given one + and eventually sets the tween's target to that value immediately. + Alpha value to start from (in case of Fade tweens) + If TRUE sets the target to from value immediately, otherwise waits for the tween to start + If TRUE the FROM/TO values will be calculated as relative to the current ones + + + Changes a TO tween into a FROM tween: sets the tween's starting value to the given one + and eventually sets the tween's target to that value immediately. + Value to start from (in case of Vector tweens that act on a single coordinate or scale tweens) + If TRUE sets the target to from value immediately, otherwise waits for the tween to start + If TRUE the FROM/TO values will be calculated as relative to the current ones + + + Changes a TO tween into a FROM tween: sets the tween's starting value to the given one + and eventually sets the tween's target to that value immediately. + Value to start from (in case of Vector tweens that act on a single coordinate or scale tweens) + If TRUE sets the target to from value immediately, otherwise waits for the tween to start + If TRUE the FROM/TO values will be calculated as relative to the current ones + + + Sets a delayed startup for the tween. + In case of Sequences behaves the same as , + which means the delay will repeat in case of loops (while with tweens it's ignored after the first loop cycle). + Has no effect if the tween has already started + + + EXPERIMENTAL: implemented in v1.2.340. + Sets a delayed startup for the tween with options to choose how the delay is applied in case of Sequences. + Has no effect if the tween has already started + Only used by types: If FALSE sets the delay as a one-time occurrence + (defaults to this for types), + otherwise as a Sequence interval which will repeat at the beginning of every loop cycle + + + Sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isRelative is TRUE sets the tween as relative + (the endValue will be calculated as startValue + endValue instead than being used directly). + Has no effect on Sequences or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + If isSpeedBased is TRUE sets the tween as speed based + (the duration will represent the number of units the tween moves x second). + Has no effect on Sequences, nested tweens, or if the tween has already started + + + Options for float tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector2 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector2 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + Selecting an axis will tween the vector only on that axis, leaving the others untouched + If TRUE the tween will smoothly snap all values to integers + + + Options for Quaternion tweens + If TRUE (default) the rotation will take the shortest route, and will not rotate more than 360°. + If FALSE the rotation will be fully accounted. Is always FALSE if the tween is set as relative + + + Options for Color tweens + If TRUE only the alpha value of the color will be tweened + + + Options for Vector4 tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector4 tweens + If TRUE, rich text will be interpreted correctly while animated, + otherwise all tags will be considered as normal text + The type of scramble to use, if any + A string containing the characters to use for scrambling. + Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters. + Leave it to NULL to use default ones + + + Options for Vector3Array tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for Vector3Array tweens + If TRUE the tween will smoothly snap all values to integers + + + Options for ShapeCircle tweens + If TRUE the center you set in the DOTween.To method will be considered as relative + to the starting position of the target + If TRUE the tween will smoothly snap all values to integers + + + Options for Path tweens (created via the DOPath shortcut) + The eventual movement axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + The eventual rotation axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + + + Options for Path tweens (created via the DOPath shortcut) + If TRUE the path will be automatically closed + The eventual movement axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + The eventual rotation axis to lock. You can input multiple axis if you separate them like this: + AxisConstrain.X | AxisConstraint.Y + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target towards the given position. + Must be chained directly to the tween creation method or to a SetOptions + The position to look at + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target towards the given position with options to keep the Z rotation stable. + Must be chained directly to the tween creation method or to a SetOptions + The position to look at + If TRUE doesn't rotate the target along the Z axis + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target towards another transform. + Must be chained directly to the tween creation method or to a SetOptions + The transform to look at + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target towards another transform with options to keep the Z rotation stable. + Must be chained directly to the tween creation method or to a SetOptions + The transform to look at + If TRUE doesn't rotate the target along the Z axis + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the target to the path, with the given lookAhead. + Must be chained directly to the tween creation method or to a SetOptions + The percentage of lookAhead to use (0 to 1) + The eventual direction to consider as "forward". + If left to NULL defaults to the regular forward side of the transform + The vector that defines in which direction up is (default: Vector3.up) + + + Additional LookAt options for Path tweens (created via the DOPath shortcut). + Orients the path with options to keep the Z rotation stable. + Must be chained directly to the tween creation method or to a SetOptions + The percentage of lookAhead to use (0 to 1) + If TRUE doesn't rotate the target along the Z axis + + + + Types of log behaviours + + + + Log only warnings and errors + + + Log warnings, errors and additional infos + + + Log only errors + + + + Indicates either a Tweener or a Sequence + + + + TimeScale for the tween + + + If TRUE the tween will play backwards + + + If TRUE the tween is completely inverted but without playing it backwards + (play backwards will actually play the tween in the original direction) + + + Object ID (usable for filtering with DOTween static methods). Can be anything except a string or an int + (use or for those) + + + String ID (usable for filtering with DOTween static methods). 2X faster than using an object id + + + Int ID (usable for filtering with DOTween static methods). 4X faster than using an object id, 2X faster than using a string id. + Default is -999 so avoid using an ID like that or it will capture all unset intIds + + + Tween target (usable for filtering with DOTween static methods). Automatically set by tween creation shortcuts + + + Called when the tween is set in a playing state, after any eventual delay. + Also called each time the tween resumes playing from a paused state + + + Called when the tween state changes from playing to paused. + If the tween has autoKill set to FALSE, this is called also when the tween reaches completion. + + + Called when the tween is rewinded, + either by calling Rewind or by reaching the start position while playing backwards. + Rewinding a tween that is already rewinded will not fire this callback + + + Called each time the tween updates + + + Called the moment the tween completes one loop cycle + + + Called the moment the tween reaches completion (loops included) + + + Called the moment the tween is killed + + + Called when a path tween's current waypoint changes + + + Tweeners-only (ignored by Sequences), returns TRUE if the tween was set as relative + + + + Set by SetTarget if DOTween's Debug Mode is on (see DOTween Utility Panel -> "Store GameObject's ID" debug option + + + + FALSE when tween is (or should be) despawned - set only by TweenManager + + + Gets and sets the time position (loops included, delays excluded) of the tween + + + Returns TRUE if the tween is set to loop (either a set number of times or infinitely) + + + TRUE after the tween was set in a play state at least once, AFTER any delay is elapsed + + + Time position within a single loop cycle + + + + Animates a single value + + + + Changes the start value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new start value + If bigger than 0 applies it as the new tween duration + + + Changes the end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new end value + If bigger than 0 applies it as the new tween duration + If TRUE the start value will become the current target's value, otherwise it will stay the same + + + Changes the end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new end value + If TRUE the start value will become the current target's value, otherwise it will stay the same + + + Changes the start and end value of a tween and rewinds it (without pausing it). + Has no effect with tweens that are inside Sequences + The new start value + The new end value + If bigger than 0 applies it as the new tween duration + + + + Used internally + + + + + Update type + + + + Updates every frame during Update calls + + + Updates every frame during LateUpdate calls + + + Updates using FixedUpdate calls + + + Updates using manual update calls + +
+
diff --git a/Assets/Plugins/Demigiant/DOTween/DOTween.XML.meta b/Assets/Plugins/Demigiant/DOTween/DOTween.XML.meta new file mode 100644 index 00000000..e3138eed --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/DOTween.XML.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 34192c5e0d14aee43a0e86cc4823268a +TextScriptImporter: + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/DOTween.XML + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/DOTween.dll b/Assets/Plugins/Demigiant/DOTween/DOTween.dll new file mode 100644 index 00000000..65032ee6 Binary files /dev/null and b/Assets/Plugins/Demigiant/DOTween/DOTween.dll differ diff --git a/Assets/Plugins/Demigiant/DOTween/DOTween.dll.meta b/Assets/Plugins/Demigiant/DOTween/DOTween.dll.meta new file mode 100644 index 00000000..4bcb4da5 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/DOTween.dll.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: a811bde74b26b53498b4f6d872b09b6d +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + WindowsStoreApps: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/DOTween.dll + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Editor.meta b/Assets/Plugins/Demigiant/DOTween/Editor.meta new file mode 100644 index 00000000..c81d2159 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b27f58ae5d5c33a4bb2d1f4f34bd036d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.XML b/Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.XML new file mode 100644 index 00000000..7d185559 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.XML @@ -0,0 +1,189 @@ + + + + DOTweenEditor + + + + + Contains compatibility methods taken from DemiEditor (for when DOTween is without it) + + + + + Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account + + + + + Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account + + + + + Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account + + + + + Warning: some versions of this method don't have the includeInactive parameter so it won't be taken into account + + + + + Starts the update loop of tween in the editor. Has no effect during playMode. + + Eventual callback to call after every update + + + + Stops the update loop and clears the onPreviewUpdated callback. + + If TRUE also resets the tweened objects to their original state. + Note that this works by calling Rewind on all tweens, so it will work correctly + only if you have a single tween type per object and it wasn't killed + If TRUE also kills any cached tween + + + + Readies the tween for editor preview by setting its UpdateType to Manual plus eventual extra settings. + + The tween to ready + If TRUE (recommended) removes all callbacks (OnComplete/Rewind/etc) + If TRUE prevents the tween from being auto-killed at completion + If TRUE starts playing the tween immediately + + + Full major version + first minor version (ex: 2018.1f) + + + Major version + + + First minor version (ex: in 2018.1 it would be 1) + + + With final slash. "Packages/" if this is a package, "Assets/" otherwise + + + With final slash (system based) - might be NULL in case users are not using a parent Demigiant folder + + + With final slash (system based). If this is a package, represents the package's Runtime dir + + + With final slash (system based). If this is a package, represents the package's Editor dir + + + DOTween editor path from Assets (not included) with final slash, in AssetDatabase format (/) + + + With final slash (system based) + + + With final slash (system based) + + + With final slash (system based) + + + + Checks that the given editor texture use the correct import settings, + and applies them if they're incorrect. + + + + + Returns TRUE if setup is required + + + + + Returns TRUE if the file/directory at the given path exists. + + Path, relative to Unity's project folder + + + + + Converts the given project-relative path to a full path, + with backward (\) slashes). + + + + + Converts the given full path to a path usable with AssetDatabase methods + (relative to Unity's project folder, and with the correct Unity forward (/) slashes). + + + + + Connects to a asset. + If the asset already exists at the given path, loads it and returns it. + Otherwise, either returns NULL or automatically creates it before loading and returning it + (depending on the given parameters). + + Asset type + File path (relative to Unity's project folder) + If TRUE and the requested asset doesn't exist, forces its creation + + + + Full path for the given loaded assembly, assembly file included + + + + + Adds the given global define if it's not already present + + + + + Removes the given global define if it's present + + + + + Returns TRUE if the given global define is present in all the + or only in the given , depending on passed parameters. + + + to use. Leave NULL to check in all of them. + + + + Not used as menu item anymore, but as a utility function + + + + Sets the modules bool values to the current defines state + + + Refreshes the enabled state of all defines + + + Applies the guiEnabled value state to each define, adding or removing them based on that + + + Removes all DOTween defines including the ones for external assets + + + Removes all legacy defines + + + Removes the define if present + + + Adds the define if it's not already present + + + Full major version + first minor version (ex: 2018.1f) + + + Major version + + + First minor version (ex: in 2018.1 it would be 1) + + + diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.XML.meta b/Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.XML.meta new file mode 100644 index 00000000..9372a94b --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.XML.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2e2c6224d345d9249acfa6e8ef40bb2d +TextScriptImporter: + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.XML + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.dll b/Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.dll new file mode 100644 index 00000000..024a2daa Binary files /dev/null and b/Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.dll differ diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.dll.meta b/Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.dll.meta new file mode 100644 index 00000000..850b36fa --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.dll.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: 45d5034162d6cf04dbe46da84fc7d074 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + DefaultValueInitialized: true + WindowsStoreApps: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Editor/DOTweenEditor.dll + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/Imgs.meta b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs.meta new file mode 100644 index 00000000..a81ba5ff --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 0034ebae0c2a9344e897db1160d71b6d +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png new file mode 100644 index 00000000..d06fc7c3 Binary files /dev/null and b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png differ diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png.meta b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png.meta new file mode 100644 index 00000000..539d43ac --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png.meta @@ -0,0 +1,54 @@ +fileFormatVersion: 2 +guid: 8da095e39e9b4df488dfd436f81116d6 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 128 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenIcon.png + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenMiniIcon.png b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenMiniIcon.png new file mode 100644 index 00000000..7cd74c1a Binary files /dev/null and b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenMiniIcon.png differ diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenMiniIcon.png.meta b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenMiniIcon.png.meta new file mode 100644 index 00000000..0c50569a --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenMiniIcon.png.meta @@ -0,0 +1,75 @@ +fileFormatVersion: 2 +guid: 61521df2e071645488ba3d05e49289ae +timeCreated: 1602317874 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Editor/Imgs/DOTweenMiniIcon.png + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer.png b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer.png new file mode 100644 index 00000000..e29d02fe Binary files /dev/null and b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer.png differ diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer.png.meta b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer.png.meta new file mode 100644 index 00000000..e0430eeb --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer.png.meta @@ -0,0 +1,54 @@ +fileFormatVersion: 2 +guid: 7051dba417b3d53409f2918f1ea4938d +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 256 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer.png + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer_dark.png b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer_dark.png new file mode 100644 index 00000000..e48db5ef Binary files /dev/null and b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer_dark.png differ diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer_dark.png.meta b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer_dark.png.meta new file mode 100644 index 00000000..54969a48 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer_dark.png.meta @@ -0,0 +1,54 @@ +fileFormatVersion: 2 +guid: 519694efe2bb2914788b151fbd8c01f4 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Footer_dark.png + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Header.jpg b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Header.jpg new file mode 100644 index 00000000..4d710d71 Binary files /dev/null and b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Header.jpg differ diff --git a/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Header.jpg.meta b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Header.jpg.meta new file mode 100644 index 00000000..715a63b8 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Header.jpg.meta @@ -0,0 +1,54 @@ +fileFormatVersion: 2 +guid: 78a59ca99f8987941adb61f9e14a06a7 +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 512 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Editor/Imgs/Header.jpg + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Modules.meta b/Assets/Plugins/Demigiant/DOTween/Modules.meta new file mode 100644 index 00000000..24cd2ac5 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 143604b8bad857d47a6f7cc7a533e2dc +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleAudio.cs b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleAudio.cs new file mode 100644 index 00000000..ada1879d --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleAudio.cs @@ -0,0 +1,198 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2018/07/13 + +#if !DOTWEEN_NOAUDIO // MODULE_MARKER +using System; +using DG.Tweening.Core; +using DG.Tweening.Plugins.Options; +using UnityEngine; +using UnityEngine.Audio; // Required for AudioMixer + +#pragma warning disable 1591 +namespace DG.Tweening +{ + public static class DOTweenModuleAudio + { + #region Shortcuts + + #region Audio + + /// Tweens an AudioSource's volume to the given value. + /// Also stores the AudioSource as the tween's target so it can be used for filtered operations + /// The end value to reach (0 to 1)The duration of the tween + public static TweenerCore DOFade(this AudioSource target, float endValue, float duration) + { + if (endValue < 0) endValue = 0; + else if (endValue > 1) endValue = 1; + TweenerCore t = DOTween.To(() => target.volume, x => target.volume = x, endValue, duration); + t.SetTarget(target); + return t; + } + + /// Tweens an AudioSource's pitch to the given value. + /// Also stores the AudioSource as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOPitch(this AudioSource target, float endValue, float duration) + { + TweenerCore t = DOTween.To(() => target.pitch, x => target.pitch = x, endValue, duration); + t.SetTarget(target); + return t; + } + + #endregion + + #region AudioMixer + + /// Tweens an AudioMixer's exposed float to the given value. + /// Also stores the AudioMixer as the tween's target so it can be used for filtered operations. + /// Note that you need to manually expose a float in an AudioMixerGroup in order to be able to tween it from an AudioMixer. + /// Name given to the exposed float to set + /// The end value to reachThe duration of the tween + public static TweenerCore DOSetFloat(this AudioMixer target, string floatName, float endValue, float duration) + { + TweenerCore t = DOTween.To(()=> { + float currVal; + target.GetFloat(floatName, out currVal); + return currVal; + }, x=> target.SetFloat(floatName, x), endValue, duration); + t.SetTarget(target); + return t; + } + + #region Operation Shortcuts + + /// + /// Completes all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens completed + /// (meaning the tweens that don't have infinite loops and were not already complete) + /// + /// For Sequences only: if TRUE also internal Sequence callbacks will be fired, + /// otherwise they will be ignored + public static int DOComplete(this AudioMixer target, bool withCallbacks = false) + { + return DOTween.Complete(target, withCallbacks); + } + + /// + /// Kills all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens killed. + /// + /// If TRUE completes the tween before killing it + public static int DOKill(this AudioMixer target, bool complete = false) + { + return DOTween.Kill(target, complete); + } + + /// + /// Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens flipped. + /// + public static int DOFlip(this AudioMixer target) + { + return DOTween.Flip(target); + } + + /// + /// Sends to the given position all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens involved. + /// + /// Time position to reach + /// (if higher than the whole tween duration the tween will simply reach its end) + /// If TRUE will play the tween after reaching the given position, otherwise it will pause it + public static int DOGoto(this AudioMixer target, float to, bool andPlay = false) + { + return DOTween.Goto(target, to, andPlay); + } + + /// + /// Pauses all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens paused. + /// + public static int DOPause(this AudioMixer target) + { + return DOTween.Pause(target); + } + + /// + /// Plays all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens played. + /// + public static int DOPlay(this AudioMixer target) + { + return DOTween.Play(target); + } + + /// + /// Plays backwards all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens played. + /// + public static int DOPlayBackwards(this AudioMixer target) + { + return DOTween.PlayBackwards(target); + } + + /// + /// Plays forward all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens played. + /// + public static int DOPlayForward(this AudioMixer target) + { + return DOTween.PlayForward(target); + } + + /// + /// Restarts all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens restarted. + /// + public static int DORestart(this AudioMixer target) + { + return DOTween.Restart(target); + } + + /// + /// Rewinds all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens rewinded. + /// + public static int DORewind(this AudioMixer target) + { + return DOTween.Rewind(target); + } + + /// + /// Smoothly rewinds all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens rewinded. + /// + public static int DOSmoothRewind(this AudioMixer target) + { + return DOTween.SmoothRewind(target); + } + + /// + /// Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference + /// (meaning tweens that were started from this target, or that had this target added as an Id) + /// and returns the total number of tweens involved. + /// + public static int DOTogglePause(this AudioMixer target) + { + return DOTween.TogglePause(target); + } + + #endregion + + #endregion + + #endregion + } +} +#endif diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleAudio.cs.meta b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleAudio.cs.meta new file mode 100644 index 00000000..418bf93a --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleAudio.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b766d08851589514b97afb23c6f30a70 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleAudio.cs + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleEPOOutline.cs b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleEPOOutline.cs new file mode 100644 index 00000000..4eb7b770 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleEPOOutline.cs @@ -0,0 +1,146 @@ +using UnityEngine; + +#if DOTWEEN_EPO || EPO_DOTWEEN // MODULE_MARKER + +using EPOOutline; +using DG.Tweening.Plugins.Options; +using DG.Tweening; +using DG.Tweening.Core; + +namespace DG.Tweening +{ + public static class DOTweenModuleEPOOutline + { + public static int DOKill(this SerializedPass target, bool complete) + { + return DOTween.Kill(target, complete); + } + + public static TweenerCore DOFloat(this SerializedPass target, string propertyName, float endValue, float duration) + { + var tweener = DOTween.To(() => target.GetFloat(propertyName), x => target.SetFloat(propertyName, x), endValue, duration); + tweener.SetOptions(true).SetTarget(target); + return tweener; + } + + public static TweenerCore DOFade(this SerializedPass target, string propertyName, float endValue, float duration) + { + var tweener = DOTween.ToAlpha(() => target.GetColor(propertyName), x => target.SetColor(propertyName, x), endValue, duration); + tweener.SetOptions(true).SetTarget(target); + return tweener; + } + + public static TweenerCore DOColor(this SerializedPass target, string propertyName, Color endValue, float duration) + { + var tweener = DOTween.To(() => target.GetColor(propertyName), x => target.SetColor(propertyName, x), endValue, duration); + tweener.SetOptions(false).SetTarget(target); + return tweener; + } + + public static TweenerCore DOVector(this SerializedPass target, string propertyName, Vector4 endValue, float duration) + { + var tweener = DOTween.To(() => target.GetVector(propertyName), x => target.SetVector(propertyName, x), endValue, duration); + tweener.SetOptions(false).SetTarget(target); + return tweener; + } + + public static TweenerCore DOFloat(this SerializedPass target, int propertyId, float endValue, float duration) + { + var tweener = DOTween.To(() => target.GetFloat(propertyId), x => target.SetFloat(propertyId, x), endValue, duration); + tweener.SetOptions(true).SetTarget(target); + return tweener; + } + + public static TweenerCore DOFade(this SerializedPass target, int propertyId, float endValue, float duration) + { + var tweener = DOTween.ToAlpha(() => target.GetColor(propertyId), x => target.SetColor(propertyId, x), endValue, duration); + tweener.SetOptions(true).SetTarget(target); + return tweener; + } + + public static TweenerCore DOColor(this SerializedPass target, int propertyId, Color endValue, float duration) + { + var tweener = DOTween.To(() => target.GetColor(propertyId), x => target.SetColor(propertyId, x), endValue, duration); + tweener.SetOptions(false).SetTarget(target); + return tweener; + } + + public static TweenerCore DOVector(this SerializedPass target, int propertyId, Vector4 endValue, float duration) + { + var tweener = DOTween.To(() => target.GetVector(propertyId), x => target.SetVector(propertyId, x), endValue, duration); + tweener.SetOptions(false).SetTarget(target); + return tweener; + } + + public static int DOKill(this Outlinable.OutlineProperties target, bool complete = false) + { + return DOTween.Kill(target, complete); + } + + public static int DOKill(this Outliner target, bool complete = false) + { + return DOTween.Kill(target, complete); + } + + /// + /// Controls the alpha (transparency) of the outline + /// + public static TweenerCore DOFade(this Outlinable.OutlineProperties target, float endValue, float duration) + { + var tweener = DOTween.ToAlpha(() => target.Color, x => target.Color = x, endValue, duration); + tweener.SetOptions(true).SetTarget(target); + return tweener; + } + + /// + /// Controls the color of the outline + /// + public static TweenerCore DOColor(this Outlinable.OutlineProperties target, Color endValue, float duration) + { + var tweener = DOTween.To(() => target.Color, x => target.Color = x, endValue, duration); + tweener.SetOptions(false).SetTarget(target); + return tweener; + } + + /// + /// Controls the amount of blur applied to the outline + /// + public static TweenerCore DOBlurShift(this Outlinable.OutlineProperties target, float endValue, float duration, bool snapping = false) + { + var tweener = DOTween.To(() => target.BlurShift, x => target.BlurShift = x, endValue, duration); + tweener.SetOptions(snapping).SetTarget(target); + return tweener; + } + + /// + /// Controls the amount of blur applied to the outline + /// + public static TweenerCore DOBlurShift(this Outliner target, float endValue, float duration, bool snapping = false) + { + var tweener = DOTween.To(() => target.BlurShift, x => target.BlurShift = x, endValue, duration); + tweener.SetOptions(snapping).SetTarget(target); + return tweener; + } + + /// + /// Controls the amount of dilation applied to the outline + /// + public static TweenerCore DODilateShift(this Outlinable.OutlineProperties target, float endValue, float duration, bool snapping = false) + { + var tweener = DOTween.To(() => target.DilateShift, x => target.DilateShift = x, endValue, duration); + tweener.SetOptions(snapping).SetTarget(target); + return tweener; + } + + /// + /// Controls the amount of dilation applied to the outline + /// + public static TweenerCore DODilateShift(this Outliner target, float endValue, float duration, bool snapping = false) + { + var tweener = DOTween.To(() => target.DilateShift, x => target.DilateShift = x, endValue, duration); + tweener.SetOptions(snapping).SetTarget(target); + return tweener; + } + } +} +#endif diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleEPOOutline.cs.meta b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleEPOOutline.cs.meta new file mode 100644 index 00000000..4e4da15c --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleEPOOutline.cs.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e944529dcaee98f4e9498d80e541d93e +timeCreated: 1602593330 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleEPOOutline.cs + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics.cs b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics.cs new file mode 100644 index 00000000..51786e30 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics.cs @@ -0,0 +1,216 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2018/07/13 + +#if !DOTWEEN_NOPHYSICS // MODULE_MARKER +using System; +using DG.Tweening.Core; +using DG.Tweening.Core.Enums; +using DG.Tweening.Plugins; +using DG.Tweening.Plugins.Core.PathCore; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening +{ + public static class DOTweenModulePhysics + { + #region Shortcuts + + #region Rigidbody + + /// Tweens a Rigidbody's position to the given value. + /// Also stores the rigidbody as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMove(this Rigidbody target, Vector3 endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.position, target.MovePosition, endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + + /// Tweens a Rigidbody's X position to the given value. + /// Also stores the rigidbody as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMoveX(this Rigidbody target, float endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue, 0, 0), duration); + t.SetOptions(AxisConstraint.X, snapping).SetTarget(target); + return t; + } + + /// Tweens a Rigidbody's Y position to the given value. + /// Also stores the rigidbody as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMoveY(this Rigidbody target, float endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue, 0), duration); + t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target); + return t; + } + + /// Tweens a Rigidbody's Z position to the given value. + /// Also stores the rigidbody as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMoveZ(this Rigidbody target, float endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue), duration); + t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target); + return t; + } + + /// Tweens a Rigidbody's rotation to the given value. + /// Also stores the rigidbody as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// Rotation mode + public static TweenerCore DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast) + { + TweenerCore t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration); + t.SetTarget(target); + t.plugOptions.rotateMode = mode; + return t; + } + + /// Tweens a Rigidbody's rotation so that it will look towards the given position. + /// Also stores the rigidbody as the tween's target so it can be used for filtered operations + /// The position to look atThe duration of the tween + /// Eventual axis constraint for the rotation + /// The vector that defines in which direction up is (default: Vector3.up) + public static TweenerCore DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null) + { + TweenerCore t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt); + t.plugOptions.axisConstraint = axisConstraint; + t.plugOptions.up = (up == null) ? Vector3.up : (Vector3)up; + return t; + } + + #region Special + + /// Tweens a Rigidbody's position to the given value, while also applying a jump effect along the Y axis. + /// Returns a Sequence instead of a Tweener. + /// Also stores the Rigidbody as the tween's target so it can be used for filtered operations + /// The end value to reach + /// Power of the jump (the max height of the jump is represented by this plus the final Y offset) + /// Total number of jumps + /// The duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Sequence DOJump(this Rigidbody target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false) + { + if (numJumps < 1) numJumps = 1; + float startPosY = 0; + float offsetY = -1; + bool offsetYSet = false; + Sequence s = DOTween.Sequence(); + Tween yTween = DOTween.To(() => target.position, target.MovePosition, new Vector3(0, jumpPower, 0), duration / (numJumps * 2)) + .SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative() + .SetLoops(numJumps * 2, LoopType.Yoyo) + .OnStart(() => startPosY = target.position.y); + s.Append(DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue.x, 0, 0), duration) + .SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear) + ).Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue.z), duration) + .SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear) + ).Join(yTween) + .SetTarget(target).SetEase(DOTween.defaultEaseType); + yTween.OnUpdate(() => { + if (!offsetYSet) { + offsetYSet = true; + offsetY = s.isRelative ? endValue.y : endValue.y - startPosY; + } + Vector3 pos = target.position; + pos.y += DOVirtual.EasedValue(0, offsetY, yTween.ElapsedPercentage(), Ease.OutQuad); + target.MovePosition(pos); + }); + return s; + } + + /// Tweens a Rigidbody's position through the given path waypoints, using the chosen path algorithm. + /// Also stores the Rigidbody as the tween's target so it can be used for filtered operations. + /// NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened. + /// BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug). + /// If you plan to publish there you should use a regular transform.DOPath. + /// The waypoints to go through + /// The duration of the tween + /// The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points) + /// The path mode: 3D, side-scroller 2D, top-down 2D + /// The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive. + /// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + /// The color of the path (shown when gizmos are active in the Play panel and the tween is running) + public static TweenerCore DOPath( + this Rigidbody target, Vector3[] path, float duration, PathType pathType = PathType.Linear, + PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null + ) + { + if (resolution < 1) resolution = 1; + TweenerCore t = DOTween.To(PathPlugin.Get(), () => target.position, target.MovePosition, new Path(pathType, path, resolution, gizmoColor), duration) + .SetTarget(target).SetUpdate(UpdateType.Fixed); + + t.plugOptions.isRigidbody = true; + t.plugOptions.mode = pathMode; + return t; + } + /// Tweens a Rigidbody's localPosition through the given path waypoints, using the chosen path algorithm. + /// Also stores the Rigidbody as the tween's target so it can be used for filtered operations + /// NOTE: to tween a rigidbody correctly it should be set to kinematic at least while being tweened. + /// BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug). + /// If you plan to publish there you should use a regular transform.DOLocalPath. + /// The waypoint to go through + /// The duration of the tween + /// The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points) + /// The path mode: 3D, side-scroller 2D, top-down 2D + /// The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive. + /// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + /// The color of the path (shown when gizmos are active in the Play panel and the tween is running) + public static TweenerCore DOLocalPath( + this Rigidbody target, Vector3[] path, float duration, PathType pathType = PathType.Linear, + PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null + ) + { + if (resolution < 1) resolution = 1; + Transform trans = target.transform; + TweenerCore t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), new Path(pathType, path, resolution, gizmoColor), duration) + .SetTarget(target).SetUpdate(UpdateType.Fixed); + + t.plugOptions.isRigidbody = true; + t.plugOptions.mode = pathMode; + t.plugOptions.useLocalPosition = true; + return t; + } + // Used by path editor when creating the actual tween, so it can pass a pre-compiled path + internal static TweenerCore DOPath( + this Rigidbody target, Path path, float duration, PathMode pathMode = PathMode.Full3D + ) + { + TweenerCore t = DOTween.To(PathPlugin.Get(), () => target.position, target.MovePosition, path, duration) + .SetTarget(target); + + t.plugOptions.isRigidbody = true; + t.plugOptions.mode = pathMode; + return t; + } + internal static TweenerCore DOLocalPath( + this Rigidbody target, Path path, float duration, PathMode pathMode = PathMode.Full3D + ) + { + Transform trans = target.transform; + TweenerCore t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), path, duration) + .SetTarget(target); + + t.plugOptions.isRigidbody = true; + t.plugOptions.mode = pathMode; + t.plugOptions.useLocalPosition = true; + return t; + } + + #endregion + + #endregion + + #endregion + } +} +#endif diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics.cs.meta b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics.cs.meta new file mode 100644 index 00000000..94486be0 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: dae9aa560b4242648a3affa2bfabc365 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics.cs + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics2D.cs b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics2D.cs new file mode 100644 index 00000000..045eccc7 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics2D.cs @@ -0,0 +1,193 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2018/07/13 + +#if !DOTWEEN_NOPHYSICS2D // MODULE_MARKER +using System; +using DG.Tweening.Core; +using DG.Tweening.Plugins; +using DG.Tweening.Plugins.Core.PathCore; +using DG.Tweening.Plugins.Options; +using UnityEngine; + +#pragma warning disable 1591 +namespace DG.Tweening +{ + public static class DOTweenModulePhysics2D + { + #region Shortcuts + + #region Rigidbody2D Shortcuts + + /// Tweens a Rigidbody2D's position to the given value. + /// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMove(this Rigidbody2D target, Vector2 endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.position, target.MovePosition, endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + + /// Tweens a Rigidbody2D's X position to the given value. + /// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMoveX(this Rigidbody2D target, float endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue, 0), duration); + t.SetOptions(AxisConstraint.X, snapping).SetTarget(target); + return t; + } + + /// Tweens a Rigidbody2D's Y position to the given value. + /// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMoveY(this Rigidbody2D target, float endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue), duration); + t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target); + return t; + } + + /// Tweens a Rigidbody2D's rotation to the given value. + /// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DORotate(this Rigidbody2D target, float endValue, float duration) + { + TweenerCore t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration); + t.SetTarget(target); + return t; + } + + #region Special + + /// Tweens a Rigidbody2D's position to the given value, while also applying a jump effect along the Y axis. + /// Returns a Sequence instead of a Tweener. + /// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations. + /// IMPORTANT: a rigidbody2D can't be animated in a jump arc using MovePosition, so the tween will directly set the position + /// The end value to reach + /// Power of the jump (the max height of the jump is represented by this plus the final Y offset) + /// Total number of jumps + /// The duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Sequence DOJump(this Rigidbody2D target, Vector2 endValue, float jumpPower, int numJumps, float duration, bool snapping = false) + { + if (numJumps < 1) numJumps = 1; + float startPosY = 0; + float offsetY = -1; + bool offsetYSet = false; + Sequence s = DOTween.Sequence(); + Tween yTween = DOTween.To(() => target.position, x => target.position = x, new Vector2(0, jumpPower), duration / (numJumps * 2)) + .SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative() + .SetLoops(numJumps * 2, LoopType.Yoyo) + .OnStart(() => startPosY = target.position.y); + s.Append(DOTween.To(() => target.position, x => target.position = x, new Vector2(endValue.x, 0), duration) + .SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear) + ).Join(yTween) + .SetTarget(target).SetEase(DOTween.defaultEaseType); + yTween.OnUpdate(() => { + if (!offsetYSet) { + offsetYSet = true; + offsetY = s.isRelative ? endValue.y : endValue.y - startPosY; + } + Vector3 pos = target.position; + pos.y += DOVirtual.EasedValue(0, offsetY, yTween.ElapsedPercentage(), Ease.OutQuad); + target.MovePosition(pos); + }); + return s; + } + + /// Tweens a Rigidbody2D's position through the given path waypoints, using the chosen path algorithm. + /// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations. + /// NOTE: to tween a Rigidbody2D correctly it should be set to kinematic at least while being tweened. + /// BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug). + /// If you plan to publish there you should use a regular transform.DOPath. + /// The waypoints to go through + /// The duration of the tween + /// The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points) + /// The path mode: 3D, side-scroller 2D, top-down 2D + /// The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive. + /// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + /// The color of the path (shown when gizmos are active in the Play panel and the tween is running) + public static TweenerCore DOPath( + this Rigidbody2D target, Vector2[] path, float duration, PathType pathType = PathType.Linear, + PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null + ) + { + if (resolution < 1) resolution = 1; + int len = path.Length; + Vector3[] path3D = new Vector3[len]; + for (int i = 0; i < len; ++i) path3D[i] = path[i]; + TweenerCore t = DOTween.To(PathPlugin.Get(), () => target.position, x => target.MovePosition(x), new Path(pathType, path3D, resolution, gizmoColor), duration) + .SetTarget(target).SetUpdate(UpdateType.Fixed); + + t.plugOptions.isRigidbody2D = true; + t.plugOptions.mode = pathMode; + return t; + } + /// Tweens a Rigidbody2D's localPosition through the given path waypoints, using the chosen path algorithm. + /// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations + /// NOTE: to tween a Rigidbody2D correctly it should be set to kinematic at least while being tweened. + /// BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug). + /// If you plan to publish there you should use a regular transform.DOLocalPath. + /// The waypoint to go through + /// The duration of the tween + /// The type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points) + /// The path mode: 3D, side-scroller 2D, top-down 2D + /// The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive. + /// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints + /// The color of the path (shown when gizmos are active in the Play panel and the tween is running) + public static TweenerCore DOLocalPath( + this Rigidbody2D target, Vector2[] path, float duration, PathType pathType = PathType.Linear, + PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null + ) + { + if (resolution < 1) resolution = 1; + int len = path.Length; + Vector3[] path3D = new Vector3[len]; + for (int i = 0; i < len; ++i) path3D[i] = path[i]; + Transform trans = target.transform; + TweenerCore t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), new Path(pathType, path3D, resolution, gizmoColor), duration) + .SetTarget(target).SetUpdate(UpdateType.Fixed); + + t.plugOptions.isRigidbody2D = true; + t.plugOptions.mode = pathMode; + t.plugOptions.useLocalPosition = true; + return t; + } + // Used by path editor when creating the actual tween, so it can pass a pre-compiled path + internal static TweenerCore DOPath( + this Rigidbody2D target, Path path, float duration, PathMode pathMode = PathMode.Full3D + ) + { + TweenerCore t = DOTween.To(PathPlugin.Get(), () => target.position, x => target.MovePosition(x), path, duration) + .SetTarget(target); + + t.plugOptions.isRigidbody2D = true; + t.plugOptions.mode = pathMode; + return t; + } + internal static TweenerCore DOLocalPath( + this Rigidbody2D target, Path path, float duration, PathMode pathMode = PathMode.Full3D + ) + { + Transform trans = target.transform; + TweenerCore t = DOTween.To(PathPlugin.Get(), () => trans.localPosition, x => target.MovePosition(trans.parent == null ? x : trans.parent.TransformPoint(x)), path, duration) + .SetTarget(target); + + t.plugOptions.isRigidbody2D = true; + t.plugOptions.mode = pathMode; + t.plugOptions.useLocalPosition = true; + return t; + } + + #endregion + + #endregion + + #endregion + } +} +#endif diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics2D.cs.meta b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics2D.cs.meta new file mode 100644 index 00000000..e7e1eb2d --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics2D.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 230fe34542e175245ba74b4659dae700 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModulePhysics2D.cs + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleSprite.cs b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleSprite.cs new file mode 100644 index 00000000..4d4a0c43 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleSprite.cs @@ -0,0 +1,93 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2018/07/13 + +#if !DOTWEEN_NOSPRITES // MODULE_MARKER +using System; +using UnityEngine; +using DG.Tweening.Core; +using DG.Tweening.Plugins.Options; + +#pragma warning disable 1591 +namespace DG.Tweening +{ + public static class DOTweenModuleSprite + { + #region Shortcuts + + #region SpriteRenderer + + /// Tweens a SpriteRenderer's color to the given value. + /// Also stores the spriteRenderer as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOColor(this SpriteRenderer target, Color endValue, float duration) + { + TweenerCore t = DOTween.To(() => target.color, x => target.color = x, endValue, duration); + t.SetTarget(target); + return t; + } + + /// Tweens a Material's alpha color to the given value. + /// Also stores the spriteRenderer as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOFade(this SpriteRenderer target, float endValue, float duration) + { + TweenerCore t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration); + t.SetTarget(target); + return t; + } + + /// Tweens a SpriteRenderer's color using the given gradient + /// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener). + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The gradient to useThe duration of the tween + public static Sequence DOGradientColor(this SpriteRenderer target, Gradient gradient, float duration) + { + Sequence s = DOTween.Sequence(); + GradientColorKey[] colors = gradient.colorKeys; + int len = colors.Length; + for (int i = 0; i < len; ++i) { + GradientColorKey c = colors[i]; + if (i == 0 && c.time <= 0) { + target.color = c.color; + continue; + } + float colorDuration = i == len - 1 + ? duration - s.Duration(false) // Verifies that total duration is correct + : duration * (i == 0 ? c.time : c.time - colors[i - 1].time); + s.Append(target.DOColor(c.color, colorDuration).SetEase(Ease.Linear)); + } + s.SetTarget(target); + return s; + } + + #endregion + + #region Blendables + + #region SpriteRenderer + + /// Tweens a SpriteRenderer's color to the given value, + /// in a way that allows other DOBlendableColor tweens to work together on the same target, + /// instead than fight each other as multiple DOColor would do. + /// Also stores the SpriteRenderer as the tween's target so it can be used for filtered operations + /// The value to tween toThe duration of the tween + public static Tweener DOBlendableColor(this SpriteRenderer target, Color endValue, float duration) + { + endValue = endValue - target.color; + Color to = new Color(0, 0, 0, 0); + return DOTween.To(() => to, x => { + Color diff = x - to; + to = x; + target.color += diff; + }, endValue, duration) + .Blendable().SetTarget(target); + } + + #endregion + + #endregion + + #endregion + } +} +#endif diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleSprite.cs.meta b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleSprite.cs.meta new file mode 100644 index 00000000..f682bc33 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleSprite.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 188918ab119d93148aa0de59ccf5286b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleSprite.cs + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUI.cs b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUI.cs new file mode 100644 index 00000000..4708449b --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUI.cs @@ -0,0 +1,662 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2018/07/13 + +#if !DOTWEEN_NOUI // MODULE_MARKER + +using System; +using System.Globalization; +using UnityEngine; +using UnityEngine.UI; +using DG.Tweening.Core; +using DG.Tweening.Core.Enums; +using DG.Tweening.Plugins; +using DG.Tweening.Plugins.Options; +using Outline = UnityEngine.UI.Outline; +using Text = UnityEngine.UI.Text; + +#pragma warning disable 1591 +namespace DG.Tweening +{ + public static class DOTweenModuleUI + { + #region Shortcuts + + #region CanvasGroup + + /// Tweens a CanvasGroup's alpha color to the given value. + /// Also stores the canvasGroup as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOFade(this CanvasGroup target, float endValue, float duration) + { + TweenerCore t = DOTween.To(() => target.alpha, x => target.alpha = x, endValue, duration); + t.SetTarget(target); + return t; + } + + #endregion + + #region Graphic + + /// Tweens an Graphic's color to the given value. + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOColor(this Graphic target, Color endValue, float duration) + { + TweenerCore t = DOTween.To(() => target.color, x => target.color = x, endValue, duration); + t.SetTarget(target); + return t; + } + + /// Tweens an Graphic's alpha color to the given value. + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOFade(this Graphic target, float endValue, float duration) + { + TweenerCore t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration); + t.SetTarget(target); + return t; + } + + #endregion + + #region Image + + /// Tweens an Image's color to the given value. + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOColor(this Image target, Color endValue, float duration) + { + TweenerCore t = DOTween.To(() => target.color, x => target.color = x, endValue, duration); + t.SetTarget(target); + return t; + } + + /// Tweens an Image's alpha color to the given value. + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOFade(this Image target, float endValue, float duration) + { + TweenerCore t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration); + t.SetTarget(target); + return t; + } + + /// Tweens an Image's fillAmount to the given value. + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The end value to reach (0 to 1)The duration of the tween + public static TweenerCore DOFillAmount(this Image target, float endValue, float duration) + { + if (endValue > 1) endValue = 1; + else if (endValue < 0) endValue = 0; + TweenerCore t = DOTween.To(() => target.fillAmount, x => target.fillAmount = x, endValue, duration); + t.SetTarget(target); + return t; + } + + /// Tweens an Image's colors using the given gradient + /// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener). + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The gradient to useThe duration of the tween + public static Sequence DOGradientColor(this Image target, Gradient gradient, float duration) + { + Sequence s = DOTween.Sequence(); + GradientColorKey[] colors = gradient.colorKeys; + int len = colors.Length; + for (int i = 0; i < len; ++i) { + GradientColorKey c = colors[i]; + if (i == 0 && c.time <= 0) { + target.color = c.color; + continue; + } + float colorDuration = i == len - 1 + ? duration - s.Duration(false) // Verifies that total duration is correct + : duration * (i == 0 ? c.time : c.time - colors[i - 1].time); + s.Append(target.DOColor(c.color, colorDuration).SetEase(Ease.Linear)); + } + s.SetTarget(target); + return s; + } + + #endregion + + #region LayoutElement + + /// Tweens an LayoutElement's flexibleWidth/Height to the given value. + /// Also stores the LayoutElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOFlexibleSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => new Vector2(target.flexibleWidth, target.flexibleHeight), x => { + target.flexibleWidth = x.x; + target.flexibleHeight = x.y; + }, endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + + /// Tweens an LayoutElement's minWidth/Height to the given value. + /// Also stores the LayoutElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMinSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => new Vector2(target.minWidth, target.minHeight), x => { + target.minWidth = x.x; + target.minHeight = x.y; + }, endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + + /// Tweens an LayoutElement's preferredWidth/Height to the given value. + /// Also stores the LayoutElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOPreferredSize(this LayoutElement target, Vector2 endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => new Vector2(target.preferredWidth, target.preferredHeight), x => { + target.preferredWidth = x.x; + target.preferredHeight = x.y; + }, endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + + #endregion + + #region Outline + + /// Tweens a Outline's effectColor to the given value. + /// Also stores the Outline as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOColor(this Outline target, Color endValue, float duration) + { + TweenerCore t = DOTween.To(() => target.effectColor, x => target.effectColor = x, endValue, duration); + t.SetTarget(target); + return t; + } + + /// Tweens a Outline's effectColor alpha to the given value. + /// Also stores the Outline as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOFade(this Outline target, float endValue, float duration) + { + TweenerCore t = DOTween.ToAlpha(() => target.effectColor, x => target.effectColor = x, endValue, duration); + t.SetTarget(target); + return t; + } + + /// Tweens a Outline's effectDistance to the given value. + /// Also stores the Outline as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOScale(this Outline target, Vector2 endValue, float duration) + { + TweenerCore t = DOTween.To(() => target.effectDistance, x => target.effectDistance = x, endValue, duration); + t.SetTarget(target); + return t; + } + + #endregion + + #region RectTransform + + /// Tweens a RectTransform's anchoredPosition to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOAnchorPos(this RectTransform target, Vector2 endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + /// Tweens a RectTransform's anchoredPosition X to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOAnchorPosX(this RectTransform target, float endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(endValue, 0), duration); + t.SetOptions(AxisConstraint.X, snapping).SetTarget(target); + return t; + } + /// Tweens a RectTransform's anchoredPosition Y to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOAnchorPosY(this RectTransform target, float endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(0, endValue), duration); + t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target); + return t; + } + + /// Tweens a RectTransform's anchoredPosition3D to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOAnchorPos3D(this RectTransform target, Vector3 endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + /// Tweens a RectTransform's anchoredPosition3D X to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOAnchorPos3DX(this RectTransform target, float endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(endValue, 0, 0), duration); + t.SetOptions(AxisConstraint.X, snapping).SetTarget(target); + return t; + } + /// Tweens a RectTransform's anchoredPosition3D Y to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOAnchorPos3DY(this RectTransform target, float endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(0, endValue, 0), duration); + t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target); + return t; + } + /// Tweens a RectTransform's anchoredPosition3D Z to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOAnchorPos3DZ(this RectTransform target, float endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.anchoredPosition3D, x => target.anchoredPosition3D = x, new Vector3(0, 0, endValue), duration); + t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target); + return t; + } + + /// Tweens a RectTransform's anchorMax to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOAnchorMax(this RectTransform target, Vector2 endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.anchorMax, x => target.anchorMax = x, endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + + /// Tweens a RectTransform's anchorMin to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOAnchorMin(this RectTransform target, Vector2 endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.anchorMin, x => target.anchorMin = x, endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + + /// Tweens a RectTransform's pivot to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOPivot(this RectTransform target, Vector2 endValue, float duration) + { + TweenerCore t = DOTween.To(() => target.pivot, x => target.pivot = x, endValue, duration); + t.SetTarget(target); + return t; + } + /// Tweens a RectTransform's pivot X to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOPivotX(this RectTransform target, float endValue, float duration) + { + TweenerCore t = DOTween.To(() => target.pivot, x => target.pivot = x, new Vector2(endValue, 0), duration); + t.SetOptions(AxisConstraint.X).SetTarget(target); + return t; + } + /// Tweens a RectTransform's pivot Y to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOPivotY(this RectTransform target, float endValue, float duration) + { + TweenerCore t = DOTween.To(() => target.pivot, x => target.pivot = x, new Vector2(0, endValue), duration); + t.SetOptions(AxisConstraint.Y).SetTarget(target); + return t; + } + + /// Tweens a RectTransform's sizeDelta to the given value. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOSizeDelta(this RectTransform target, Vector2 endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.sizeDelta, x => target.sizeDelta = x, endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + + /// Punches a RectTransform's anchoredPosition towards the given direction and then back to the starting one + /// as if it was connected to the starting position via an elastic. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The direction and strength of the punch (added to the RectTransform's current position) + /// The duration of the tween + /// Indicates how much will the punch vibrate + /// Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + /// 1 creates a full oscillation between the punch direction and the opposite direction, + /// while 0 oscillates only between the punch and the start position + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOPunchAnchorPos(this RectTransform target, Vector2 punch, float duration, int vibrato = 10, float elasticity = 1, bool snapping = false) + { + return DOTween.Punch(() => target.anchoredPosition, x => target.anchoredPosition = x, punch, duration, vibrato, elasticity) + .SetTarget(target).SetOptions(snapping); + } + + /// Shakes a RectTransform's anchoredPosition with the given values. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The duration of the tween + /// The shake strength + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + /// If TRUE the tween will smoothly snap all values to integers + /// If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + /// Randomness mode + public static Tweener DOShakeAnchorPos(this RectTransform target, float duration, float strength = 100, int vibrato = 10, float randomness = 90, bool snapping = false, bool fadeOut = true, ShakeRandomnessMode randomnessMode = ShakeRandomnessMode.Full) + { + return DOTween.Shake(() => target.anchoredPosition, x => target.anchoredPosition = x, duration, strength, vibrato, randomness, true, fadeOut, randomnessMode) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake).SetOptions(snapping); + } + /// Shakes a RectTransform's anchoredPosition with the given values. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The duration of the tween + /// The shake strength on each axis + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + /// If TRUE the tween will smoothly snap all values to integers + /// If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + /// Randomness mode + public static Tweener DOShakeAnchorPos(this RectTransform target, float duration, Vector2 strength, int vibrato = 10, float randomness = 90, bool snapping = false, bool fadeOut = true, ShakeRandomnessMode randomnessMode = ShakeRandomnessMode.Full) + { + return DOTween.Shake(() => target.anchoredPosition, x => target.anchoredPosition = x, duration, strength, vibrato, randomness, fadeOut, randomnessMode) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake).SetOptions(snapping); + } + + #region Special + + /// Tweens a RectTransform's anchoredPosition to the given value, while also applying a jump effect along the Y axis. + /// Returns a Sequence instead of a Tweener. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations + /// The end value to reach + /// Power of the jump (the max height of the jump is represented by this plus the final Y offset) + /// Total number of jumps + /// The duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Sequence DOJumpAnchorPos(this RectTransform target, Vector2 endValue, float jumpPower, int numJumps, float duration, bool snapping = false) + { + if (numJumps < 1) numJumps = 1; + float startPosY = 0; + float offsetY = -1; + bool offsetYSet = false; + + // Separate Y Tween so we can elaborate elapsedPercentage on that insted of on the Sequence + // (in case users add a delay or other elements to the Sequence) + Sequence s = DOTween.Sequence(); + Tween yTween = DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(0, jumpPower), duration / (numJumps * 2)) + .SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative() + .SetLoops(numJumps * 2, LoopType.Yoyo) + .OnStart(()=> startPosY = target.anchoredPosition.y); + s.Append(DOTween.To(() => target.anchoredPosition, x => target.anchoredPosition = x, new Vector2(endValue.x, 0), duration) + .SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear) + ).Join(yTween) + .SetTarget(target).SetEase(DOTween.defaultEaseType); + s.OnUpdate(() => { + if (!offsetYSet) { + offsetYSet = true; + offsetY = s.isRelative ? endValue.y : endValue.y - startPosY; + } + Vector2 pos = target.anchoredPosition; + pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad); + target.anchoredPosition = pos; + }); + return s; + } + + #endregion + + #endregion + + #region ScrollRect + + /// Tweens a ScrollRect's horizontal/verticalNormalizedPosition to the given value. + /// Also stores the ScrollRect as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DONormalizedPos(this ScrollRect target, Vector2 endValue, float duration, bool snapping = false) + { + return DOTween.To(() => new Vector2(target.horizontalNormalizedPosition, target.verticalNormalizedPosition), + x => { + target.horizontalNormalizedPosition = x.x; + target.verticalNormalizedPosition = x.y; + }, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + /// Tweens a ScrollRect's horizontalNormalizedPosition to the given value. + /// Also stores the ScrollRect as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOHorizontalNormalizedPos(this ScrollRect target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.horizontalNormalizedPosition, x => target.horizontalNormalizedPosition = x, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + /// Tweens a ScrollRect's verticalNormalizedPosition to the given value. + /// Also stores the ScrollRect as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOVerticalNormalizedPos(this ScrollRect target, float endValue, float duration, bool snapping = false) + { + return DOTween.To(() => target.verticalNormalizedPosition, x => target.verticalNormalizedPosition = x, endValue, duration) + .SetOptions(snapping).SetTarget(target); + } + + #endregion + + #region Slider + + /// Tweens a Slider's value to the given value. + /// Also stores the Slider as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOValue(this Slider target, float endValue, float duration, bool snapping = false) + { + TweenerCore t = DOTween.To(() => target.value, x => target.value = x, endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + + #endregion + + #region Text + + /// Tweens a Text's color to the given value. + /// Also stores the Text as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOColor(this Text target, Color endValue, float duration) + { + TweenerCore t = DOTween.To(() => target.color, x => target.color = x, endValue, duration); + t.SetTarget(target); + return t; + } + + /// + /// Tweens a Text's text from one integer to another, with options for thousands separators + /// + /// The value to start from + /// The end value to reach + /// The duration of the tween + /// If TRUE (default) also adds thousands separators + /// The to use (InvariantCulture if NULL) + public static TweenerCore DOCounter( + this Text target, int fromValue, int endValue, float duration, bool addThousandsSeparator = true, CultureInfo culture = null + ){ + int v = fromValue; + CultureInfo cInfo = !addThousandsSeparator ? null : culture ?? CultureInfo.InvariantCulture; + TweenerCore t = DOTween.To(() => v, x => { + v = x; + target.text = addThousandsSeparator + ? v.ToString("N0", cInfo) + : v.ToString(); + }, endValue, duration); + t.SetTarget(target); + return t; + } + + /// Tweens a Text's alpha color to the given value. + /// Also stores the Text as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOFade(this Text target, float endValue, float duration) + { + TweenerCore t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration); + t.SetTarget(target); + return t; + } + + /// Tweens a Text's text to the given value. + /// Also stores the Text as the tween's target so it can be used for filtered operations + /// The end string to tween toThe duration of the tween + /// If TRUE (default), rich text will be interpreted correctly while animated, + /// otherwise all tags will be considered as normal text + /// The type of scramble mode to use, if any + /// A string containing the characters to use for scrambling. + /// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters. + /// Leave it to NULL (default) to use default ones + public static TweenerCore DOText(this Text target, string endValue, float duration, bool richTextEnabled = true, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null) + { + if (endValue == null) { + if (Debugger.logPriority > 0) Debugger.LogWarning("You can't pass a NULL string to DOText: an empty string will be used instead to avoid errors"); + endValue = ""; + } + TweenerCore t = DOTween.To(() => target.text, x => target.text = x, endValue, duration); + t.SetOptions(richTextEnabled, scrambleMode, scrambleChars) + .SetTarget(target); + return t; + } + + #endregion + + #region Blendables + + #region Graphic + + /// Tweens a Graphic's color to the given value, + /// in a way that allows other DOBlendableColor tweens to work together on the same target, + /// instead than fight each other as multiple DOColor would do. + /// Also stores the Graphic as the tween's target so it can be used for filtered operations + /// The value to tween toThe duration of the tween + public static Tweener DOBlendableColor(this Graphic target, Color endValue, float duration) + { + endValue = endValue - target.color; + Color to = new Color(0, 0, 0, 0); + return DOTween.To(() => to, x => { + Color diff = x - to; + to = x; + target.color += diff; + }, endValue, duration) + .Blendable().SetTarget(target); + } + + #endregion + + #region Image + + /// Tweens a Image's color to the given value, + /// in a way that allows other DOBlendableColor tweens to work together on the same target, + /// instead than fight each other as multiple DOColor would do. + /// Also stores the Image as the tween's target so it can be used for filtered operations + /// The value to tween toThe duration of the tween + public static Tweener DOBlendableColor(this Image target, Color endValue, float duration) + { + endValue = endValue - target.color; + Color to = new Color(0, 0, 0, 0); + return DOTween.To(() => to, x => { + Color diff = x - to; + to = x; + target.color += diff; + }, endValue, duration) + .Blendable().SetTarget(target); + } + + #endregion + + #region Text + + /// Tweens a Text's color BY the given value, + /// in a way that allows other DOBlendableColor tweens to work together on the same target, + /// instead than fight each other as multiple DOColor would do. + /// Also stores the Text as the tween's target so it can be used for filtered operations + /// The value to tween toThe duration of the tween + public static Tweener DOBlendableColor(this Text target, Color endValue, float duration) + { + endValue = endValue - target.color; + Color to = new Color(0, 0, 0, 0); + return DOTween.To(() => to, x => { + Color diff = x - to; + to = x; + target.color += diff; + }, endValue, duration) + .Blendable().SetTarget(target); + } + + #endregion + + #endregion + + #region Shapes + + /// Tweens a RectTransform's anchoredPosition so that it draws a circle around the given center. + /// Also stores the RectTransform as the tween's target so it can be used for filtered operations. + /// IMPORTANT: SetFrom(value) requires a instead of a float, where the X property represents the "from degrees value" + /// Circle-center/pivot around which to rotate (in UI anchoredPosition coordinates) + /// The end value degrees to reach (to rotate counter-clockwise pass a negative value) + /// The duration of the tween + /// If TRUE the coordinates will be considered as relative to the target's current anchoredPosition + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOShapeCircle( + this RectTransform target, Vector2 center, float endValueDegrees, float duration, bool relativeCenter = false, bool snapping = false + ) + { + TweenerCore t = DOTween.To( + CirclePlugin.Get(), () => target.anchoredPosition, x => target.anchoredPosition = x, center, duration + ); + t.SetOptions(endValueDegrees, relativeCenter, snapping).SetTarget(target); + return t; + } + + #endregion + + #endregion + + // █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ + // ███ INTERNAL CLASSES ████████████████████████████████████████████████████████████████████████████████████████████████ + // █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ + + public static class Utils + { + /// + /// Converts the anchoredPosition of the first RectTransform to the second RectTransform, + /// taking into consideration offset, anchors and pivot, and returns the new anchoredPosition + /// + public static Vector2 SwitchToRectTransform(RectTransform from, RectTransform to) + { + Vector2 localPoint; + Vector2 fromPivotDerivedOffset = new Vector2(from.rect.width * 0.5f + from.rect.xMin, from.rect.height * 0.5f + from.rect.yMin); + Vector2 screenP = RectTransformUtility.WorldToScreenPoint(null, from.position); + screenP += fromPivotDerivedOffset; + RectTransformUtility.ScreenPointToLocalPointInRectangle(to, screenP, null, out localPoint); + Vector2 pivotDerivedOffset = new Vector2(to.rect.width * 0.5f + to.rect.xMin, to.rect.height * 0.5f + to.rect.yMin); + return to.anchoredPosition + localPoint - pivotDerivedOffset; + } + } + } +} +#endif diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUI.cs.meta b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUI.cs.meta new file mode 100644 index 00000000..c8f77d01 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUI.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: a060394c03331a64392db53a10e7f2d1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUI.cs + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUIToolkit.cs b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUIToolkit.cs new file mode 100644 index 00000000..7f077088 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUIToolkit.cs @@ -0,0 +1,161 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2026/01/08 + +#if DOTWEEN_UITOOLKIT && UNITY_2021_3_OR_NEWER // MODULE_MARKER + +using UnityEngine; +using UnityEngine.UIElements; +using DG.Tweening.Core; +using DG.Tweening.Core.Enums; +using DG.Tweening.Plugins.Options; + +#pragma warning disable 1591 +namespace DG.Tweening +{ + public static class DOTweenModuleUIToolkit + { + #region Shortcuts + + #region VisualElement + + /// Tweens a VisualElement's position (via style.translate) to the given value. + /// Also stores the VisualElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMove(this VisualElement target, Vector3 endValue, float duration, bool snapping = false) + { + TweenerCore t + = DOTween.To(() => target.resolvedStyle.translate, x => target.style.translate = new Translate(x.x, x.y, x.z), endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + /// Tweens a VisualElement's position (via style.translate) to the given value. + /// Also stores the VisualElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMove(this VisualElement target, Vector2 endValue, float duration, bool snapping = false) + { + TweenerCore t + = DOTween.To(() => (Vector2)target.resolvedStyle.translate, x => target.style.translate = new Translate(x.x, x.y, 0), endValue, duration); + t.SetOptions(snapping).SetTarget(target); + return t; + } + /// Tweens a VisualElement's X position (via style.translate) to the given value. + /// Also stores the VisualElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMoveX(this VisualElement target, float endValue, float duration, bool snapping = false) + { + TweenerCore t + = DOTween.To(() => target.resolvedStyle.translate, x => target.style.translate = new Translate(x.x, x.y, x.z), new Vector3(endValue, 0, 0), duration); + t.SetOptions(AxisConstraint.X, snapping).SetTarget(target); + return t; + } + /// Tweens a VisualElement's Y position (via style.translate) to the given value. + /// Also stores the VisualElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMoveY(this VisualElement target, float endValue, float duration, bool snapping = false) + { + TweenerCore t + = DOTween.To(() => target.resolvedStyle.translate, x => target.style.translate = new Translate(x.x, x.y, x.z), new Vector3(0, endValue, 0), duration); + t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target); + return t; + } + /// Tweens a VisualElement's Z position (via style.translate) to the given value. + /// Also stores the VisualElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + /// If TRUE the tween will smoothly snap all values to integers + public static TweenerCore DOMoveZ(this VisualElement target, float endValue, float duration, bool snapping = false) + { + TweenerCore t + = DOTween.To(() => target.resolvedStyle.translate, x => target.style.translate = new Translate(x.x, x.y, x.z), new Vector3(0, 0, endValue), duration); + t.SetOptions(AxisConstraint.Z, snapping).SetTarget(target); + return t; + } + + /// Tweens a VisualElement's scale (via style.scale) to the given value. + /// Also stores the VisualElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOScale(this VisualElement target, Vector2 endValue, float duration) + { + TweenerCore t + = DOTween.To(() => (Vector2)target.resolvedStyle.scale.value, x => target.style.scale = new Scale(x), endValue, duration); + t.SetTarget(target); + return t; + } + /// Tweens a VisualElement's scale (via style.scale) to the given value. + /// Also stores the VisualElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DOScale(this VisualElement target, float endValue, float duration) + { + TweenerCore t + = DOTween.To(() => (Vector2)target.resolvedStyle.scale.value, x => target.style.scale = new Scale(x), new Vector2(endValue, endValue), duration); + t.SetTarget(target); + return t; + } + + /// Tweens a VisualElement's rotation (via style.rotate) to the given value. + /// Also stores the VisualElement as the tween's target so it can be used for filtered operations + /// The end value to reachThe duration of the tween + public static TweenerCore DORotate(this VisualElement target, float endValue, float duration) + { + TweenerCore t + = DOTween.To(() => target.resolvedStyle.rotate.angle.value, x => target.style.rotate = new Rotate(x), endValue, duration); + t.SetTarget(target); + return t; + } + + /// Punches a VisualElement's position towards the given direction and then back to the starting one + /// as if it was connected to the starting position via an elastic. + /// Also stores the VisualElement as the tween's target so it can be used for filtered operations + /// The direction and strength of the punch (added to the VisualElement's current position) + /// The duration of the tween + /// Indicates how much will the punch vibrate + /// Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards. + /// 1 creates a full oscillation between the punch direction and the opposite direction, + /// while 0 oscillates only between the punch and the start position + /// If TRUE the tween will smoothly snap all values to integers + public static Tweener DOPunch(this VisualElement target, Vector3 punch, float duration, int vibrato = 10, float elasticity = 1, bool snapping = false) + { + return DOTween.Punch(() => target.resolvedStyle.translate, x => target.style.translate = new Translate(x.x, x.y, x.z), punch, duration, vibrato, elasticity) + .SetTarget(target).SetOptions(snapping); + } + + /// Shakes a VisualElement's position with the given values. + /// Also stores the VisualElement as the tween's target so it can be used for filtered operations + /// The duration of the tween + /// The shake strength + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + /// If TRUE the tween will smoothly snap all values to integers + /// If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + /// Randomness mode + public static Tweener DOShake(this VisualElement target, float duration, float strength = 100, int vibrato = 10, float randomness = 90, bool snapping = false, bool fadeOut = true, ShakeRandomnessMode randomnessMode = ShakeRandomnessMode.Full) + { + return DOTween.Shake(() => target.resolvedStyle.translate, x => target.style.translate = new Translate(x.x, x.y, x.z), duration, strength, vibrato, randomness, true, fadeOut, randomnessMode) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake).SetOptions(snapping); + } + /// Shakes a VisualElement's position with the given values. + /// Also stores the VisualElement as the tween's target so it can be used for filtered operations + /// The duration of the tween + /// The shake strength on each axis + /// Indicates how much will the shake vibrate + /// Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware). + /// Setting it to 0 will shake along a single direction. + /// If TRUE the tween will smoothly snap all values to integers + /// If TRUE the shake will automatically fadeOut smoothly within the tween's duration, otherwise it will not + /// Randomness mode + public static Tweener DOShake(this VisualElement target, float duration, Vector2 strength, int vibrato = 10, float randomness = 90, bool snapping = false, bool fadeOut = true, ShakeRandomnessMode randomnessMode = ShakeRandomnessMode.Full) + { + return DOTween.Shake(() => target.resolvedStyle.translate, x => target.style.translate = new Translate(x.x, x.y, x.z), duration, strength, vibrato, randomness, fadeOut, randomnessMode) + .SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake).SetOptions(snapping); + } + + #endregion + + #endregion + } +} +#endif diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUIToolkit.cs.meta b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUIToolkit.cs.meta new file mode 100644 index 00000000..319cc3d8 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUIToolkit.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 0c0a6d2683fb84e4193f2aa968264881 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUIToolkit.cs + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUnityVersion.cs b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUnityVersion.cs new file mode 100644 index 00000000..8f818ba5 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUnityVersion.cs @@ -0,0 +1,389 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2018/07/13 + +using System; +using UnityEngine; +using DG.Tweening.Core; +using DG.Tweening.Plugins.Options; +//#if UNITY_2018_1_OR_NEWER && (NET_4_6 || NET_STANDARD_2_0) +//using Task = System.Threading.Tasks.Task; +//#endif + +#pragma warning disable 1591 +namespace DG.Tweening +{ + /// + /// Shortcuts/functions that are not strictly related to specific Modules + /// but are available only on some Unity versions + /// + public static class DOTweenModuleUnityVersion + { + #region Material + + /// Tweens a Material's color using the given gradient + /// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener). + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The gradient to useThe duration of the tween + public static Sequence DOGradientColor(this Material target, Gradient gradient, float duration) + { + Sequence s = DOTween.Sequence(); + GradientColorKey[] colors = gradient.colorKeys; + int len = colors.Length; + for (int i = 0; i < len; ++i) { + GradientColorKey c = colors[i]; + if (i == 0 && c.time <= 0) { + target.color = c.color; + continue; + } + float colorDuration = i == len - 1 + ? duration - s.Duration(false) // Verifies that total duration is correct + : duration * (i == 0 ? c.time : c.time - colors[i - 1].time); + s.Append(target.DOColor(c.color, colorDuration).SetEase(Ease.Linear)); + } + s.SetTarget(target); + return s; + } + /// Tweens a Material's named color property using the given gradient + /// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener). + /// Also stores the image as the tween's target so it can be used for filtered operations + /// The gradient to use + /// The name of the material property to tween (like _Tint or _SpecColor) + /// The duration of the tween + public static Sequence DOGradientColor(this Material target, Gradient gradient, string property, float duration) + { + Sequence s = DOTween.Sequence(); + GradientColorKey[] colors = gradient.colorKeys; + int len = colors.Length; + for (int i = 0; i < len; ++i) { + GradientColorKey c = colors[i]; + if (i == 0 && c.time <= 0) { + target.SetColor(property, c.color); + continue; + } + float colorDuration = i == len - 1 + ? duration - s.Duration(false) // Verifies that total duration is correct + : duration * (i == 0 ? c.time : c.time - colors[i - 1].time); + s.Append(target.DOColor(c.color, property, colorDuration).SetEase(Ease.Linear)); + } + s.SetTarget(target); + return s; + } + + #endregion + + #region CustomYieldInstructions + + /// + /// Returns a that waits until the tween is killed or complete. + /// It can be used inside a coroutine as a yield. + /// Example usage:yield return myTween.WaitForCompletion(true); + /// + public static CustomYieldInstruction WaitForCompletion(this Tween t, bool returnCustomYieldInstruction) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return null; + } + return new DOTweenCYInstruction.WaitForCompletion(t); + } + + /// + /// Returns a that waits until the tween is killed or rewinded. + /// It can be used inside a coroutine as a yield. + /// Example usage:yield return myTween.WaitForRewind(); + /// + public static CustomYieldInstruction WaitForRewind(this Tween t, bool returnCustomYieldInstruction) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return null; + } + return new DOTweenCYInstruction.WaitForRewind(t); + } + + /// + /// Returns a that waits until the tween is killed. + /// It can be used inside a coroutine as a yield. + /// Example usage:yield return myTween.WaitForKill(); + /// + public static CustomYieldInstruction WaitForKill(this Tween t, bool returnCustomYieldInstruction) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return null; + } + return new DOTweenCYInstruction.WaitForKill(t); + } + + /// + /// Returns a that waits until the tween is killed or has gone through the given amount of loops. + /// It can be used inside a coroutine as a yield. + /// Example usage:yield return myTween.WaitForElapsedLoops(2); + /// + /// Elapsed loops to wait for + public static CustomYieldInstruction WaitForElapsedLoops(this Tween t, int elapsedLoops, bool returnCustomYieldInstruction) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return null; + } + return new DOTweenCYInstruction.WaitForElapsedLoops(t, elapsedLoops); + } + + /// + /// Returns a that waits until the tween is killed + /// or has reached the given time position (loops included, delays excluded). + /// It can be used inside a coroutine as a yield. + /// Example usage:yield return myTween.WaitForPosition(2.5f); + /// + /// Position (loops included, delays excluded) to wait for + public static CustomYieldInstruction WaitForPosition(this Tween t, float position, bool returnCustomYieldInstruction) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return null; + } + return new DOTweenCYInstruction.WaitForPosition(t, position); + } + + /// + /// Returns a that waits until the tween is killed or started + /// (meaning when the tween is set in a playing state the first time, after any eventual delay). + /// It can be used inside a coroutine as a yield. + /// Example usage:yield return myTween.WaitForStart(); + /// + public static CustomYieldInstruction WaitForStart(this Tween t, bool returnCustomYieldInstruction) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return null; + } + return new DOTweenCYInstruction.WaitForStart(t); + } + + #endregion + +#if UNITY_2018_1_OR_NEWER + #region Unity 2018.1 or Newer + + #region Material + + /// Tweens a Material's named texture offset property with the given ID to the given value. + /// Also stores the material as the tween's target so it can be used for filtered operations + /// The end value to reach + /// The ID of the material property to tween (also called nameID in Unity's manual) + /// The duration of the tween + public static TweenerCore DOOffset(this Material target, Vector2 endValue, int propertyID, float duration) + { + if (!target.HasProperty(propertyID)) { + if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID); + return null; + } + TweenerCore t = DOTween.To(() => target.GetTextureOffset(propertyID), x => target.SetTextureOffset(propertyID, x), endValue, duration); + t.SetTarget(target); + return t; + } + + /// Tweens a Material's named texture scale property with the given ID to the given value. + /// Also stores the material as the tween's target so it can be used for filtered operations + /// The end value to reach + /// The ID of the material property to tween (also called nameID in Unity's manual) + /// The duration of the tween + public static TweenerCore DOTiling(this Material target, Vector2 endValue, int propertyID, float duration) + { + if (!target.HasProperty(propertyID)) { + if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(propertyID); + return null; + } + TweenerCore t = DOTween.To(() => target.GetTextureScale(propertyID), x => target.SetTextureScale(propertyID, x), endValue, duration); + t.SetTarget(target); + return t; + } + + #endregion + + #region .NET 4.6 or Newer + +#if UNITY_2018_1_OR_NEWER && (NET_4_6 || NET_STANDARD_2_0) + + #region Async Instructions + + /// + /// Returns an async that waits until the tween is killed or complete. + /// It can be used inside an async operation. + /// Example usage:await myTween.WaitForCompletion(); + /// + public static async System.Threading.Tasks.Task AsyncWaitForCompletion(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return; + } + while (t.active && !t.IsComplete()) await System.Threading.Tasks.Task.Yield(); + } + + /// + /// Returns an async that waits until the tween is killed or rewinded. + /// It can be used inside an async operation. + /// Example usage:await myTween.AsyncWaitForRewind(); + /// + public static async System.Threading.Tasks.Task AsyncWaitForRewind(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return; + } + while (t.active && (!t.playedOnce || t.position * (t.CompletedLoops() + 1) > 0)) await System.Threading.Tasks.Task.Yield(); + } + + /// + /// Returns an async that waits until the tween is killed. + /// It can be used inside an async operation. + /// Example usage:await myTween.AsyncWaitForKill(); + /// + public static async System.Threading.Tasks.Task AsyncWaitForKill(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return; + } + while (t.active) await System.Threading.Tasks.Task.Yield(); + } + + /// + /// Returns an async that waits until the tween is killed or has gone through the given amount of loops. + /// It can be used inside an async operation. + /// Example usage:await myTween.AsyncWaitForElapsedLoops(); + /// + /// Elapsed loops to wait for + public static async System.Threading.Tasks.Task AsyncWaitForElapsedLoops(this Tween t, int elapsedLoops) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return; + } + while (t.active && t.CompletedLoops() < elapsedLoops) await System.Threading.Tasks.Task.Yield(); + } + + /// + /// Returns an async that waits until the tween is killed or started + /// (meaning when the tween is set in a playing state the first time, after any eventual delay). + /// It can be used inside an async operation. + /// Example usage:await myTween.AsyncWaitForPosition(); + /// + /// Position (loops included, delays excluded) to wait for + public static async System.Threading.Tasks.Task AsyncWaitForPosition(this Tween t, float position) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return; + } + while (t.active && t.position * (t.CompletedLoops() + 1) < position) await System.Threading.Tasks.Task.Yield(); + } + + /// + /// Returns an async that waits until the tween is killed. + /// It can be used inside an async operation. + /// Example usage:await myTween.AsyncWaitForKill(); + /// + public static async System.Threading.Tasks.Task AsyncWaitForStart(this Tween t) + { + if (!t.active) { + if (Debugger.logPriority > 0) Debugger.LogInvalidTween(t); + return; + } + while (t.active && !t.playedOnce) await System.Threading.Tasks.Task.Yield(); + } + + #endregion +#endif + + #endregion + + #endregion +#endif + } + + // █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ + // ███ CLASSES █████████████████████████████████████████████████████████████████████████████████████████████████████████ + // █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ + + public static class DOTweenCYInstruction + { + public class WaitForCompletion : CustomYieldInstruction + { + public override bool keepWaiting { get { + return t.active && !t.IsComplete(); + }} + readonly Tween t; + public WaitForCompletion(Tween tween) + { + t = tween; + } + } + + public class WaitForRewind : CustomYieldInstruction + { + public override bool keepWaiting { get { + return t.active && (!t.playedOnce || t.position * (t.CompletedLoops() + 1) > 0); + }} + readonly Tween t; + public WaitForRewind(Tween tween) + { + t = tween; + } + } + + public class WaitForKill : CustomYieldInstruction + { + public override bool keepWaiting { get { + return t.active; + }} + readonly Tween t; + public WaitForKill(Tween tween) + { + t = tween; + } + } + + public class WaitForElapsedLoops : CustomYieldInstruction + { + public override bool keepWaiting { get { + return t.active && t.CompletedLoops() < elapsedLoops; + }} + readonly Tween t; + readonly int elapsedLoops; + public WaitForElapsedLoops(Tween tween, int elapsedLoops) + { + t = tween; + this.elapsedLoops = elapsedLoops; + } + } + + public class WaitForPosition : CustomYieldInstruction + { + public override bool keepWaiting { get { + return t.active && t.position * (t.CompletedLoops() + 1) < position; + }} + readonly Tween t; + readonly float position; + public WaitForPosition(Tween tween, float position) + { + t = tween; + this.position = position; + } + } + + public class WaitForStart : CustomYieldInstruction + { + public override bool keepWaiting { get { + return t.active && !t.playedOnce; + }} + readonly Tween t; + public WaitForStart(Tween tween) + { + t = tween; + } + } + } +} diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUnityVersion.cs.meta b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUnityVersion.cs.meta new file mode 100644 index 00000000..95fa583e --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUnityVersion.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 63c02322328255542995bd02b47b0457 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUnityVersion.cs + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs new file mode 100644 index 00000000..747d68a5 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs @@ -0,0 +1,174 @@ +// Author: Daniele Giardini - http://www.demigiant.com +// Created: 2018/07/13 + +using System; +using System.Reflection; +using UnityEngine; +using DG.Tweening.Core; +using DG.Tweening.Plugins.Core.PathCore; +using DG.Tweening.Plugins.Options; + +#pragma warning disable 1591 +namespace DG.Tweening +{ + /// + /// Utility functions that deal with available Modules and rewrite them. + /// Modules defines: + /// - DOTAUDIO + /// - DOTPHYSICS + /// - DOTPHYSICS2D + /// - DOTSPRITE + /// - DOTUI + /// Extra defines set and used for implementation of external assets: + /// - DOTWEEN_TMP ► TextMesh Pro + /// - DOTWEEN_TK2D ► 2D Toolkit + /// + public static class DOTweenModuleUtils + { +#pragma warning disable UDR0001 + static bool _initialized; +#pragma warning restore UDR0001 + + #region Reflection + + /// + /// Called via Reflection by DOTweenComponent on Awake + /// +#pragma warning disable UDR0001 +#if UNITY_2018_1_OR_NEWER + [UnityEngine.Scripting.Preserve] +#endif + public static void Init() + { + if (_initialized) return; + + _initialized = true; + DOTweenExternalCommand.SetOrientationOnPath -= Physics.SetOrientationOnPath; + DOTweenExternalCommand.SetOrientationOnPath += Physics.SetOrientationOnPath; + +#if UNITY_EDITOR +#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1 + UnityEditor.EditorApplication.playmodeStateChanged -= PlaymodeStateChanged; + UnityEditor.EditorApplication.playmodeStateChanged += PlaymodeStateChanged; +#else + UnityEditor.EditorApplication.playModeStateChanged -= PlaymodeStateChanged; + UnityEditor.EditorApplication.playModeStateChanged += PlaymodeStateChanged; +#endif +#endif + } +#pragma warning restore UDR0001 + +#if UNITY_2018_1_OR_NEWER +#pragma warning disable + [UnityEngine.Scripting.Preserve] + // Just used to preserve methods when building, never called + static void Preserver() + { + Assembly[] loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies(); + MethodInfo mi = typeof(MonoBehaviour).GetMethod("Stub"); + } +#pragma warning restore +#endif + + #endregion + +#if UNITY_EDITOR + // Fires OnApplicationPause in DOTweenComponent even when Editor is paused (otherwise it's only fired at runtime) +#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_2017_1 + static void PlaymodeStateChanged() + #else + static void PlaymodeStateChanged(UnityEditor.PlayModeStateChange state) +#endif + { + if (DOTween.instance == null) return; + DOTween.instance.OnApplicationPause(UnityEditor.EditorApplication.isPaused); + } +#endif + + // █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ + // ███ INTERNAL CLASSES ████████████████████████████████████████████████████████████████████████████████████████████████ + // █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ + + public static class Physics + { + // Called via DOTweenExternalCommand callback + public static void SetOrientationOnPath(PathOptions options, Tween t, Quaternion newRot, Transform trans) + { +#if !DOTWEEN_NOPHYSICS // PHYSICS_MARKER + if (options.isRigidbody) ((Rigidbody)t.target).rotation = newRot; + else trans.rotation = newRot; +#else + trans.rotation = newRot; +#endif + } + + // Returns FALSE if the DOTween's Physics2D Module is disabled, or if there's no Rigidbody2D attached + public static bool HasRigidbody2D(Component target) + { +#if !DOTWEEN_NOPHYSICS2D // PHYSICS2D_MARKER + return target.GetComponent() != null; +#else + return false; +#endif + } + + #region Called via Reflection + + + // Called via Reflection by DOTweenPathInspector + // Returns FALSE if the DOTween's Physics Module is disabled, or if there's no rigidbody attached +#if UNITY_2018_1_OR_NEWER + [UnityEngine.Scripting.Preserve] +#endif + public static bool HasRigidbody(Component target) + { +#if !DOTWEEN_NOPHYSICS // PHYSICS_MARKER + return target.GetComponent() != null; +#else + return false; +#endif + } + + // Called via Reflection by DOTweenPath +#if UNITY_2018_1_OR_NEWER + [UnityEngine.Scripting.Preserve] +#endif + public static TweenerCore CreateDOTweenPathTween( + MonoBehaviour target, bool tweenRigidbody, bool isLocal, Path path, float duration, PathMode pathMode + ){ + TweenerCore t = null; + bool rBodyFoundAndTweened = false; +#if !DOTWEEN_NOPHYSICS // PHYSICS_MARKER + if (tweenRigidbody) { + Rigidbody rBody = target.GetComponent(); + if (rBody != null) { + rBodyFoundAndTweened = true; + t = isLocal + ? rBody.DOLocalPath(path, duration, pathMode) + : rBody.DOPath(path, duration, pathMode); + } + } +#endif +#if !DOTWEEN_NOPHYSICS2D // PHYSICS2D_MARKER + if (!rBodyFoundAndTweened && tweenRigidbody) { + Rigidbody2D rBody2D = target.GetComponent(); + if (rBody2D != null) { + rBodyFoundAndTweened = true; + t = isLocal + ? rBody2D.DOLocalPath(path, duration, pathMode) + : rBody2D.DOPath(path, duration, pathMode); + } + } +#endif + if (!rBodyFoundAndTweened) { + t = isLocal + ? target.transform.DOLocalPath(path, duration, pathMode) + : target.transform.DOPath(path, duration, pathMode); + } + return t; + } + + #endregion + } + } +} diff --git a/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs.meta b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs.meta new file mode 100644 index 00000000..edcdb0c7 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: 7bcaf917d9cf5b84090421a5a2abe42e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/Modules/DOTweenModuleUtils.cs + uploadId: 939688 diff --git a/Assets/Plugins/Demigiant/DOTween/readme.txt b/Assets/Plugins/Demigiant/DOTween/readme.txt new file mode 100644 index 00000000..26eee185 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/readme.txt @@ -0,0 +1,31 @@ +DOTween and DOTween Pro are copyright (c) 2014-2026 Daniele Giardini - Demigiant + + +// IMPORTANT!!! ///////////////////////////////////////////// +// Upgrading DOTween from versions older than 1.2.815 /////// +// or DOTween Pro older than 1.0.405 //////////////////////// +// (February 6 2026) //////////////////////////////////////// +------------------------------------------------------------- +1) Import the new version in the same folder as the previous one (Plugins/Demigiant), overwriting old files. A lot of errors will appear but don't worry. +2) Close and reopen Unity (and your project) without entering safe mode. This is fundamental: skipping this step will cause a bloodbath +3) Open DOTween's Utility Panel (Tools > Demigiant > DOTween Utility Panel) if it doesn't open automatically, then press "Setup DOTween...": this will run the upgrade setup +4) From the Add/Remove Modules panel that opens, activate/deactivate Modules for Unity systems and for external assets (Pro version only) + + +// GET STARTED ////////////////////////////////////////////// + +- After importing a new DOTween update, select DOTween's Utility Panel from the "Tools/Demigiant" menu (if it doesn't open automatically) and press the "Setup DOTween..." button to activate/deactivate Modules. You can also access a Preferences Tab from there to choose default settings for DOTween. +- In your code, add "using DG.Tweening" to each class where you want to use DOTween. +- You're ready to tween. Check out the links below for full documentation and license info. + + +// LINKS /////////////////////////////////////////////////////// + +DOTween website (documentation, examples, etc): http://dotween.demigiant.com +DOTween license: http://dotween.demigiant.com/license.php +DOTween repository (GitHub): https://github.com/Demigiant/dotween +Demigiant website: http://www.demigiant.com + +// NOTES ////////////////////////////////////////////////////// + +- DOTween's Utility Panel can be found under "Tools > Demigiant > DOTween Utility Panel" and also contains other useful options, plus a tab to set DOTween's preferences \ No newline at end of file diff --git a/Assets/Plugins/Demigiant/DOTween/readme.txt.meta b/Assets/Plugins/Demigiant/DOTween/readme.txt.meta new file mode 100644 index 00000000..554bb802 --- /dev/null +++ b/Assets/Plugins/Demigiant/DOTween/readme.txt.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fccfc62abf2eb0a4db614853430894fd +TextScriptImporter: + userData: +AssetOrigin: + serializedVersion: 1 + productId: 27676 + packageName: DOTween (HOTween v2) + packageVersion: 1.2.825 + assetPath: Assets/Plugins/Demigiant/DOTween/readme.txt + uploadId: 939688 diff --git a/Assets/Prefabs/BlackPenCanvas.prefab b/Assets/Prefabs/BlackPenCanvas.prefab new file mode 100644 index 00000000..0f4aff5e --- /dev/null +++ b/Assets/Prefabs/BlackPenCanvas.prefab @@ -0,0 +1,127 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &121000000000001 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 121000000000002} + - component: {fileID: 121000000000003} + - component: {fileID: 121000000000004} + - component: {fileID: 121000000000005} + - component: {fileID: 121000000000006} + m_Layer: 5 + m_Name: BlackPenCanvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &121000000000002 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 121000000000001} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!223 &121000000000003 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 121000000000001} + m_Enabled: 0 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 1 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_UseReflectionProbes: 0 + m_AdditionalShaderChannelsFlag: 31 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 500 + m_TargetDisplay: 0 +--- !u!114 &121000000000004 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 121000000000001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.CanvasScaler + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1280, y: 720} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0.5 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!114 &121000000000005 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 121000000000001} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.GraphicRaycaster + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &121000000000006 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 121000000000001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 23c19cf3133943568de801074af58c78, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::PaintEditorCanvas + textureWidth: 1280 + textureHeight: 720 + startOpen: 0 + blackPenOnly: 1 + penSize: 20 + markerSize: 32 + eraserSize: 24 + worldSpawnPosition: {x: 0, y: 0, z: 0} + worldPixelsPerUnit: 100 + worldSortingOrder: 10 diff --git a/Assets/Prefabs/BlackPenCanvas.prefab.meta b/Assets/Prefabs/BlackPenCanvas.prefab.meta new file mode 100644 index 00000000..450dc688 --- /dev/null +++ b/Assets/Prefabs/BlackPenCanvas.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 201ea92e03ac4494bb5424c3e284c6fb +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/EvidenceCard.prefab b/Assets/Prefabs/EvidenceCard.prefab new file mode 100644 index 00000000..3d5366f9 --- /dev/null +++ b/Assets/Prefabs/EvidenceCard.prefab @@ -0,0 +1,587 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &626862531384200315 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 888922129568707630} + - component: {fileID: 382582311896280019} + - component: {fileID: 5884412735262400619} + - component: {fileID: 5876848699488213328} + - component: {fileID: 4458473461353621329} + m_Layer: 5 + m_Name: EvidenceCard + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &888922129568707630 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 626862531384200315} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 6347784903780713838} + - {fileID: 24510894834770244} + - {fileID: 6048931739186486515} + - {fileID: 4486944289851257397} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -180, y: -8} + m_SizeDelta: {x: 203.2, y: 200.2} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &382582311896280019 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 626862531384200315} + m_CullTransparentMesh: 1 +--- !u!114 &5884412735262400619 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 626862531384200315} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 4502059151166531557, guid: d0b812af2547bd345b45c5bd3eb0eabe, type: 3} + m_Type: 0 + m_PreserveAspect: 1 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5876848699488213328 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 626862531384200315} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Button + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 5884412735262400619} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 4458473461353621329} + m_TargetAssemblyTypeName: EvidenceCardUI, Assembly-CSharp + m_MethodName: OnCardClicked + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &4458473461353621329 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 626862531384200315} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 09d516a15ac130949ac6c7786dcb6001, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::EvidenceCardUI + noteBackground: {fileID: 5884412735262400619} + noteVariants: + - {fileID: 4502059151166531557, guid: d0b812af2547bd345b45c5bd3eb0eabe, type: 3} + - {fileID: -2654900912091873650, guid: a5c3e97dee48c35438ab28c6b0752556, type: 3} + - {fileID: -2634547011037757618, guid: d63991ca90bcef74ea10b013788f08f3, type: 3} + - {fileID: 323230245057533145, guid: 302792815ae704547909174ed0540238, type: 3} + evidenceNameText: {fileID: 7247826888460297008} + descriptionText: {fileID: 7051515314946873669} + evidenceImage: {fileID: 1217414269916116351} + selectedBorder: {fileID: 3618819322661495511} +--- !u!1 &2521373768986091688 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4486944289851257397} + - component: {fileID: 4935696983183606854} + - component: {fileID: 7051515314946873669} + m_Layer: 5 + m_Name: Description + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4486944289851257397 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2521373768986091688} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 888922129568707630} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -3.800003, y: 46.1} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4935696983183606854 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2521373768986091688} + m_CullTransparentMesh: 1 +--- !u!114 &7051515314946873669 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2521373768986091688} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Ollie turn down the music test text Ollie turn down the music test text Ollie turn down the music test text ' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 13.7 + m_fontSizeBase: 13.7 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_characterHorizontalScale: 1 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656bu + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 6.8433228, y: 0, z: 2.281128, w: -117.09656} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &3618819322661495511 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6347784903780713838} + - component: {fileID: 1956894589229897898} + - component: {fileID: 2592470948924668723} + m_Layer: 5 + m_Name: SelectedBorder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &6347784903780713838 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3618819322661495511} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 888922129568707630} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1956894589229897898 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3618819322661495511} + m_CullTransparentMesh: 1 +--- !u!114 &2592470948924668723 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3618819322661495511} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 0.13679248, g: 0.31839794, b: 1, a: 0.36862746} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &3854576073094816932 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6048931739186486515} + - component: {fileID: 348213661022478848} + - component: {fileID: 1217414269916116351} + m_Layer: 5 + m_Name: EvidenceImage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6048931739186486515 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3854576073094816932} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 888922129568707630} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -18, y: -4} + m_SizeDelta: {x: 150, y: 150} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &348213661022478848 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3854576073094816932} + m_CullTransparentMesh: 1 +--- !u!114 &1217414269916116351 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3854576073094816932} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &5121340513607762529 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 24510894834770244} + - component: {fileID: 4125462206292602887} + - component: {fileID: 7247826888460297008} + m_Layer: 5 + m_Name: EvidenceName + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &24510894834770244 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5121340513607762529} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 888922129568707630} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 5.600006, y: 70.4} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4125462206292602887 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5121340513607762529} + m_CullTransparentMesh: 1 +--- !u!114 &7247826888460297008 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5121340513607762529} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'text name + +' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 15.9 + m_fontSizeBase: 15.9 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 5 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_characterHorizontalScale: 1 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656bu + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} diff --git a/Assets/Prefabs/EvidenceCard.prefab.meta b/Assets/Prefabs/EvidenceCard.prefab.meta new file mode 100644 index 00000000..38ad8692 --- /dev/null +++ b/Assets/Prefabs/EvidenceCard.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3ed632a08b340e24593cd554b7c63bd1 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/FreeCamPlayer.prefab b/Assets/Prefabs/FreeCamPlayer.prefab index 4ebd5657..a8f0d53b 100644 --- a/Assets/Prefabs/FreeCamPlayer.prefab +++ b/Assets/Prefabs/FreeCamPlayer.prefab @@ -127,7 +127,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &6256445668574344547 Transform: m_ObjectHideFlags: 0 @@ -158,6 +158,7 @@ GameObject: - component: {fileID: 3343620868280005057} - component: {fileID: 7547594087457626281} - component: {fileID: 3839992973359997269} + - component: {fileID: 8844017241159200132} m_Layer: 0 m_Name: FreeCamPlayer m_TagString: Untagged @@ -188,7 +189,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5154484800931780872} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3} m_Name: @@ -231,7 +232,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5154484800931780872} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 618b0e3f6c65dd247a4a016150006c57, type: 3} m_Name: @@ -264,14 +265,8 @@ MonoBehaviour: _parent: {fileID: 0} _invertedPathToNearestParent: _directChildren: [] - _components: - - target: {fileID: 3632144021381091555} - activeAsOwner: 1 - - target: {fileID: 3343620868280005057} - activeAsOwner: 1 - _gameObjects: - - target: {fileID: 3705720497282655305} - activeAsOwner: 0 + _components: [] + _gameObjects: [] _applyInLateUpdate: 0 _toActivate: [] _toDeactivate: [] @@ -311,6 +306,30 @@ MonoBehaviour: _ownerAuth: 1 _interpolationTiming: 0 _adaptiveSynchronization: 2 +--- !u!114 &8844017241159200132 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5154484800931780872} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: eebe6788196487a47bff27a2ea71eb78, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::Networking + _networkRules: {fileID: 0} + _visitiblityRules: {fileID: 0} + _isSetup: 0 + _prefabId: -2147483648 + _hasPrefabScope: 0 + _prefabScope: 0 + _componentIndex: -2147483648 + _shouldBePooled: 0 + _parent: {fileID: 0} + _invertedPathToNearestParent: + _directChildren: [] + defendant: 1 --- !u!1 &9125522938505943470 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/PaintEditorCanvas.prefab b/Assets/Prefabs/PaintEditorCanvas.prefab new file mode 100644 index 00000000..34792816 --- /dev/null +++ b/Assets/Prefabs/PaintEditorCanvas.prefab @@ -0,0 +1,126 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &120000000000001 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 120000000000002} + - component: {fileID: 120000000000003} + - component: {fileID: 120000000000004} + - component: {fileID: 120000000000005} + - component: {fileID: 120000000000006} + m_Layer: 5 + m_Name: PaintEditorCanvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &120000000000002 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 120000000000001} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!223 &120000000000003 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 120000000000001} + m_Enabled: 0 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 1 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 500 + m_TargetDisplay: 0 +--- !u!114 &120000000000004 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 120000000000001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.CanvasScaler + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1280, y: 720} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0.5 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!114 &120000000000005 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 120000000000001} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.GraphicRaycaster + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &120000000000006 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 120000000000001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 23c19cf3133943568de801074af58c78, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::PaintEditorCanvas + textureWidth: 1280 + textureHeight: 720 + startOpen: 0 + penSize: 8 + markerSize: 32 + eraserSize: 24 + worldSpawnPosition: {x: 0, y: 0, z: 0} + worldPixelsPerUnit: 100 + worldSortingOrder: 10 diff --git a/Assets/Prefabs/PaintEditorCanvas.prefab.meta b/Assets/Prefabs/PaintEditorCanvas.prefab.meta new file mode 100644 index 00000000..cb71a552 --- /dev/null +++ b/Assets/Prefabs/PaintEditorCanvas.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b4f27ee75e9a4c9f9adcd5d69b795645 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RenderTextures.meta b/Assets/RenderTextures.meta new file mode 100644 index 00000000..1648905b --- /dev/null +++ b/Assets/RenderTextures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b6cc28aa62974f27b5ff03b7d542f398 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RenderTextures/Car 1.renderTexture b/Assets/RenderTextures/Car 1.renderTexture new file mode 100644 index 00000000..7096fc8c --- /dev/null +++ b/Assets/RenderTextures/Car 1.renderTexture @@ -0,0 +1,39 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Car 1 + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_IsAlphaChannelOptional: 0 + serializedVersion: 6 + m_Width: 960 + m_Height: 360 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthStencilFormat: 90 + m_ColorFormat: 4 + m_MipMap: 0 + m_GenerateMips: 0 + m_SRGB: 1 + m_UseDynamicScale: 0 + m_UseDynamicScaleExplicit: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_EnableRandomWrite: 0 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 + m_ShadowSamplingMode: 2 diff --git a/Assets/RenderTextures/Car 1.renderTexture.meta b/Assets/RenderTextures/Car 1.renderTexture.meta new file mode 100644 index 00000000..f3214a34 --- /dev/null +++ b/Assets/RenderTextures/Car 1.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 11111222223333344444555556666677 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 8400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RenderTextures/Car 2.renderTexture b/Assets/RenderTextures/Car 2.renderTexture new file mode 100644 index 00000000..a58462b1 --- /dev/null +++ b/Assets/RenderTextures/Car 2.renderTexture @@ -0,0 +1,39 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!84 &8400000 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Car 2 + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_IsAlphaChannelOptional: 0 + serializedVersion: 6 + m_Width: 960 + m_Height: 360 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthStencilFormat: 90 + m_ColorFormat: 4 + m_MipMap: 0 + m_GenerateMips: 0 + m_SRGB: 1 + m_UseDynamicScale: 0 + m_UseDynamicScaleExplicit: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_EnableRandomWrite: 0 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 0 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 + m_ShadowSamplingMode: 2 diff --git a/Assets/RenderTextures/Car 2.renderTexture.meta b/Assets/RenderTextures/Car 2.renderTexture.meta new file mode 100644 index 00000000..51a4ca74 --- /dev/null +++ b/Assets/RenderTextures/Car 2.renderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8888899999aaaaabbbbbcccccdddddee +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 8400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources.meta b/Assets/Resources.meta new file mode 100644 index 00000000..abd95339 --- /dev/null +++ b/Assets/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f0039713df05c284d8fdc9091eeb19c3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/DOTweenSettings.asset b/Assets/Resources/DOTweenSettings.asset new file mode 100644 index 00000000..e193ed27 --- /dev/null +++ b/Assets/Resources/DOTweenSettings.asset @@ -0,0 +1,55 @@ +%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: 16995157, guid: a811bde74b26b53498b4f6d872b09b6d, type: 3} + m_Name: DOTweenSettings + m_EditorClassIdentifier: DOTween.dll::DG.Tweening.Core.DOTweenSettings + useSafeMode: 1 + safeModeOptions: + logBehaviour: 2 + nestedTweenFailureBehaviour: 0 + timeScale: 1 + unscaledTimeScale: 1 + useSmoothDeltaTime: 0 + maxSmoothUnscaledTime: 0.15 + rewindCallbackMode: 0 + showUnityEditorReport: 0 + logBehaviour: 0 + drawGizmos: 1 + defaultRecyclable: 0 + defaultAutoPlay: 3 + defaultUpdateType: 0 + defaultTimeScaleIndependent: 0 + defaultEaseType: 6 + defaultEaseOvershootOrAmplitude: 1.70158 + defaultEasePeriod: 0 + defaultAutoKill: 1 + defaultLoopType: 0 + debugMode: 0 + debugStoreTargetId: 1 + showPreviewPanel: 1 + storeSettingsLocation: 0 + modules: + showPanel: 0 + audioEnabled: 1 + physicsEnabled: 1 + physics2DEnabled: 1 + spriteEnabled: 1 + uiEnabled: 1 + uiToolkitEnabled: 0 + textMeshProEnabled: 0 + tk2DEnabled: 0 + deAudioEnabled: 0 + deUnityExtendedEnabled: 0 + epoOutlineEnabled: 0 + createASMDEF: 0 + showPlayingTweens: 0 + showPausedTweens: 0 diff --git a/Assets/Resources/DOTweenSettings.asset.meta b/Assets/Resources/DOTweenSettings.asset.meta new file mode 100644 index 00000000..22f7343a --- /dev/null +++ b/Assets/Resources/DOTweenSettings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a17b3e3c2083fe54da900d321ca0bdd4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/CaseSelection.unity b/Assets/Scenes/CaseSelection.unity new file mode 100644 index 00000000..2bdf6f4f --- /dev/null +++ b/Assets/Scenes/CaseSelection.unity @@ -0,0 +1,263 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 10 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 2 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 2 + m_PVRDenoiserTypeIndirect: 2 + m_PVRDenoiserTypeAO: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 1 + m_PVRFilteringGaussRadiusAO: 1 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1121015696 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1121015700} + - component: {fileID: 1121015699} + - component: {fileID: 1121015698} + - component: {fileID: 1121015697} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1121015697 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1121015696} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.UniversalAdditionalCameraData + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 0 + m_Cameras: [] + m_RendererIndex: -1 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_VolumeFrameworkUpdateModeOption: 2 + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_ClearDepth: 1 + m_AllowXRRendering: 1 + m_AllowHDROutput: 1 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_TaaSettings: + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 + m_Version: 2 +--- !u!81 &1121015698 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1121015696} + m_Enabled: 1 +--- !u!20 &1121015699 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1121015696} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1121015700 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1121015696} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 1121015700} diff --git a/Assets/Scenes/CaseSelection.unity.meta b/Assets/Scenes/CaseSelection.unity.meta new file mode 100644 index 00000000..63f43ba3 --- /dev/null +++ b/Assets/Scenes/CaseSelection.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 68fb80ff564ec7241b011df9fca4b321 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MainGame.unity b/Assets/Scenes/MainGame.unity index 70bfa413..4c3a8394 100644 --- a/Assets/Scenes/MainGame.unity +++ b/Assets/Scenes/MainGame.unity @@ -14,19 +14,19 @@ OcclusionCullingSettings: RenderSettings: m_ObjectHideFlags: 0 serializedVersion: 10 - m_Fog: 1 + m_Fog: 0 m_FogColor: {r: 0.84549654, g: 0.9433962, b: 0.9433962, a: 1} m_FogMode: 3 m_FogDensity: 0.02 m_LinearFogStart: 0 m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 0.2578616, g: 0.2578616, b: 0.2578616, a: 1} + m_AmbientSkyColor: {r: 0.21176471, g: 0.22745098, b: 0.25882354, a: 1} m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} m_AmbientIntensity: 1 - m_AmbientMode: 0 + m_AmbientMode: 3 m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} - m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_SkyboxMaterial: {fileID: 0} m_HaloStrength: 0.5 m_FlareStrength: 1 m_FlareFadeSpeed: 3 @@ -93,7 +93,7 @@ LightmapSettings: m_ExportTrainingData: 0 m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 - m_LightingDataAsset: {fileID: 112000000, guid: fcf9b5770062af54cadd9c34838013d3, type: 2} + m_LightingDataAsset: {fileID: 0} m_LightingSettings: {fileID: 0} --- !u!196 &4 NavMeshSettings: @@ -119,7 +119,7 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!1 &203844586 +--- !u!1 &9301001 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -127,193 +127,94 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 203844589} - - component: {fileID: 203844588} - - component: {fileID: 203844587} + - component: {fileID: 9301002} + - component: {fileID: 9301003} + - component: {fileID: 9301004} m_Layer: 0 - m_Name: Directional Light + m_Name: Cinemachine FollowCamera - Car m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &203844587 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 203844586} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} - m_Name: - m_EditorClassIdentifier: - m_UsePipelineSettings: 1 - m_AdditionalLightsShadowResolutionTier: 2 - m_CustomShadowLayers: 0 - m_LightCookieSize: {x: 1, y: 1} - m_LightCookieOffset: {x: 0, y: 0} - m_SoftShadowQuality: 1 - m_RenderingLayersMask: - serializedVersion: 0 - m_Bits: 1 - m_ShadowRenderingLayersMask: - serializedVersion: 0 - m_Bits: 1 - m_Version: 4 - m_LightLayerMask: 1 - m_ShadowLayerMask: 1 - m_RenderingLayers: 1 - m_ShadowRenderingLayers: 1 ---- !u!108 &203844588 -Light: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 203844586} - m_Enabled: 1 - serializedVersion: 13 - m_Type: 1 - m_Color: {r: 1, g: 0.9785366, b: 0.92, a: 1} - m_Intensity: 3.14159 - m_Range: 10 - m_SpotAngle: 30 - m_InnerSpotAngle: 21.80208 - m_CookieSize2D: {x: 10, y: 10} - m_Shadows: - m_Type: 2 - m_Resolution: -1 - m_CustomResolution: -1 - m_Strength: 0.8 - m_Bias: 0.05 - m_NormalBias: 0.4 - m_NearPlane: 0.2 - m_CullingMatrixOverride: - e00: 1 - e01: 0 - e02: 0 - e03: 0 - e10: 0 - e11: 1 - e12: 0 - e13: 0 - e20: 0 - e21: 0 - e22: 1 - e23: 0 - e30: 0 - e31: 0 - e32: 0 - e33: 1 - m_UseCullingMatrixOverride: 0 - m_Cookie: {fileID: 0} - m_DrawHalo: 0 - m_Flare: {fileID: 0} - m_RenderMode: 0 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingLayerMask: 1 - m_Lightmapping: 1 - m_LightShadowCasterMode: 0 - m_AreaSize: {x: 1, y: 1} - m_BounceIntensity: 1 - m_ColorTemperature: 6570 - m_UseColorTemperature: 0 - m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} - m_UseBoundingSphereOverride: 0 - m_UseViewFrustumForShadowCasterCull: 1 - m_ForceVisible: 0 - m_ShapeRadius: 0 - m_ShadowAngle: 0 - m_LightUnit: 1 - m_LuxAtDistance: 1 - m_EnableSpotReflector: 1 ---- !u!4 &203844589 +--- !u!4 &9301002 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 203844586} + m_GameObject: {fileID: 9301001} serializedVersion: 2 - m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} - m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -35.63153, y: -12.24, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 604712594} - m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} ---- !u!1 &505702789 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 505702790} - m_Layer: 0 - m_Name: Geometry - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 - m_IsActive: 1 ---- !u!4 &505702790 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 505702789} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 697948586} - - {fileID: 7823694312774259421} - m_Father: {fileID: 0} + m_Father: {fileID: 1787493463} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &604712593 -GameObject: +--- !u!114 &9301003 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 604712594} - m_Layer: 0 - m_Name: Lights - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &604712594 -Transform: + m_GameObject: {fileID: 9301001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineCamera + Priority: + Enabled: 0 + m_Value: 0 + OutputChannel: 2 + StandbyUpdate: 2 + m_StreamingVersion: 20241001 + m_LegacyPriority: 10 + Target: + TrackingTarget: {fileID: 314779088} + LookAtTarget: {fileID: 0} + CustomLookAtTarget: 0 + Lens: + FieldOfView: 60 + OrthographicSize: 5 + NearClipPlane: 0.1 + FarClipPlane: 1000 + Dutch: 0 + ModeOverride: 1 + PhysicalProperties: + GateFit: 2 + SensorSize: {x: 21.946, y: 16.002} + LensShift: {x: 0, y: 0} + FocusDistance: 10 + Iso: 200 + ShutterSpeed: 0.005 + Aperture: 16 + BladeCount: 5 + Curvature: {x: 2, y: 11} + BarrelClipping: 0.25 + Anamorphism: 0 + BlendHint: 0 +--- !u!114 &9301004 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 604712593} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 203844589} - - {fileID: 2116198339} - - {fileID: 1182891855} - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &697948582 + m_GameObject: {fileID: 9301001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b617507da6d07e749b7efdb34e1173e1, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineFollow + TrackerSettings: + BindingMode: 4 + PositionDamping: {x: 1, y: 1, z: 1} + AngularDampingMode: 0 + RotationDamping: {x: 1, y: 1, z: 1} + QuaternionDamping: 1 + FollowOffset: {x: 0, y: 0, z: -10} +--- !u!1 &9302001 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -321,143 +222,44 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 697948586} - - component: {fileID: 697948585} - - component: {fileID: 697948584} - - component: {fileID: 697948583} + - component: {fileID: 9302002} + - component: {fileID: 9302003} + - component: {fileID: 9302004} + - component: {fileID: 9302005} m_Layer: 0 - m_Name: Ground + m_Name: Render Camera - Car m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!64 &697948583 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 697948582} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 0 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 5 - m_Convex: 0 - m_CookingOptions: 30 - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &697948584 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 697948582} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_ForceMeshLod: -1 - m_MeshLodSelectionBias: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 9c7e8d44526b4ab4aae3f5977bbf2a94, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 2 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_GlobalIlluminationMeshLod: 0 - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_MaskInteraction: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &697948585 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 697948582} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &697948586 +--- !u!4 &9302002 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 697948582} + m_GameObject: {fileID: 9302001} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 20, y: 20, z: 20} + m_LocalPosition: {x: -35.63153, y: -12.24, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 505702790} + m_Father: {fileID: 1787493463} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &961739749 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 961739753} - - component: {fileID: 961739752} - - component: {fileID: 961739751} - - component: {fileID: 961739750} - - component: {fileID: 961739755} - m_Layer: 0 - m_Name: Main Camera - m_TagString: MainCamera - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &961739750 +--- !u!114 &9302003 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 961739749} + m_GameObject: {fileID: 9302001} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} m_Name: - m_EditorClassIdentifier: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.UniversalAdditionalCameraData m_RenderShadows: 1 m_RequiresDepthTextureOption: 2 m_RequiresOpaqueTextureOption: 2 @@ -469,14 +271,14 @@ MonoBehaviour: m_Bits: 1 m_VolumeTrigger: {fileID: 0} m_VolumeFrameworkUpdateModeOption: 2 - m_RenderPostProcessing: 1 - m_Antialiasing: 1 - m_AntialiasingQuality: 0 + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 m_StopNaN: 0 - m_Dithering: 1 + m_Dithering: 0 m_ClearDepth: 1 - m_AllowXRRendering: 1 - m_AllowHDROutput: 1 + m_AllowXRRendering: 0 + m_AllowHDROutput: 0 m_UseScreenCoordOverride: 0 m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} @@ -490,105 +292,82 @@ MonoBehaviour: m_VarianceClampScale: 0.9 m_ContrastAdaptiveSharpening: 0 m_Version: 2 ---- !u!81 &961739751 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 961739749} - m_Enabled: 1 ---- !u!20 &961739752 +--- !u!20 &9302004 Camera: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 961739749} + m_GameObject: {fileID: 9302001} m_Enabled: 1 serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_projectionMatrixMode: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.08, g: 0.1, b: 0.14, a: 0} + m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 m_Iso: 200 m_ShutterSpeed: 0.005 m_Aperture: 16 m_FocusDistance: 10 - m_FocalLength: 10.991284 + m_FocalLength: 50 m_BladeCount: 5 m_Curvature: {x: 2, y: 11} m_BarrelClipping: 0.25 m_Anamorphism: 0 - m_SensorSize: {x: 21.946, y: 16.002} + m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} m_NormalizedViewPortRect: serializedVersion: 2 x: 0 - y: 0 + y: -0.3 width: 1 - height: 1 + height: 0.9 near clip plane: 0.1 - far clip plane: 5000 - field of view: 72.104774 - orthographic: 0 - orthographic size: 10 - m_Depth: 0 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 m_CullingMask: serializedVersion: 2 m_Bits: 4294967295 m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} + m_TargetTexture: {fileID: 8400000, guid: 11111222223333344444555556666677, type: 2} m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 0 + m_TargetEye: 0 + m_HDR: 1 m_AllowMSAA: 0 m_AllowDynamicResolution: 0 m_ForceIntoRT: 0 - m_OcclusionCulling: 1 + m_OcclusionCulling: 0 m_StereoConvergence: 10 m_StereoSeparation: 0.022 ---- !u!4 &961739753 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 961739749} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} - m_LocalPosition: {x: 0, y: 1, z: 7} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} ---- !u!114 &961739755 +--- !u!114 &9302005 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 961739749} + m_GameObject: {fileID: 9302001} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3} m_Name: m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineBrain ShowDebugText: 0 - ShowCameraFrustum: 1 + ShowCameraFrustum: 0 IgnoreTimeScale: 0 WorldUpOverride: {fileID: 0} - ChannelMask: -1 + ChannelMask: 2 UpdateMethod: 2 BlendUpdateMethod: 1 LensModeOverride: Enabled: 0 DefaultMode: 2 DefaultBlend: - Style: 1 - Time: 2 + Style: 0 + Time: 0 CustomCurve: serializedVersion: 2 m_Curve: [] @@ -596,7 +375,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 CustomBlends: {fileID: 0} ---- !u!1 &1160234425 +--- !u!1 &9303001 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -604,48 +383,94 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 1160234427} - - component: {fileID: 1160234426} + - component: {fileID: 9303002} + - component: {fileID: 9303003} + - component: {fileID: 9303004} m_Layer: 0 - m_Name: Global Volume + m_Name: Cinemachine FollowCamera - Car (1) m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &1160234426 +--- !u!4 &9303002 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9303001} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 143.71912, y: -38.566196, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1908478822} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &9303003 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1160234425} + m_GameObject: {fileID: 9303001} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} + m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3} m_Name: - m_EditorClassIdentifier: - m_IsGlobal: 1 - priority: 0 - blendDistance: 0 - weight: 1 - sharedProfile: {fileID: 11400000, guid: 8844a2814356b584cb53afabd361c18a, type: 2} ---- !u!4 &1160234427 -Transform: + m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineCamera + Priority: + Enabled: 0 + m_Value: 0 + OutputChannel: 4 + StandbyUpdate: 2 + m_StreamingVersion: 20241001 + m_LegacyPriority: 10 + Target: + TrackingTarget: {fileID: 2130553444} + LookAtTarget: {fileID: 0} + CustomLookAtTarget: 0 + Lens: + FieldOfView: 60 + OrthographicSize: 5 + NearClipPlane: 0.1 + FarClipPlane: 1000 + Dutch: 0 + ModeOverride: 1 + PhysicalProperties: + GateFit: 2 + SensorSize: {x: 21.946, y: 16.002} + LensShift: {x: 0, y: 0} + FocusDistance: 10 + Iso: 200 + ShutterSpeed: 0.005 + Aperture: 16 + BladeCount: 5 + Curvature: {x: 2, y: 11} + BarrelClipping: 0.25 + Anamorphism: 0 + BlendHint: 0 +--- !u!114 &9303004 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1160234425} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1182891853 + m_GameObject: {fileID: 9303001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b617507da6d07e749b7efdb34e1173e1, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineFollow + TrackerSettings: + BindingMode: 4 + PositionDamping: {x: 1, y: 1, z: 1} + AngularDampingMode: 0 + RotationDamping: {x: 1, y: 1, z: 1} + QuaternionDamping: 1 + FollowOffset: {x: 0, y: 0, z: -10} +--- !u!1 &9304001 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -653,154 +478,160 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 1182891855} - - component: {fileID: 1182891854} + - component: {fileID: 9304002} + - component: {fileID: 9304003} + - component: {fileID: 9304004} + - component: {fileID: 9304005} m_Layer: 0 - m_Name: Adaptive Probe Volume + m_Name: Render Camera - Car (1) m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &1182891854 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1182891853} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: cded085d155cde949b60f67a11dbc3bd, type: 3} - m_Name: - m_EditorClassIdentifier: Unity.RenderPipelines.Core.Runtime::UnityEngine.Rendering.ProbeVolume - version: 2 - globalVolume: 0 - mode: 2 - size: {x: 20, y: 6, z: 20} - overrideRendererFilters: 0 - minRendererVolumeSize: 0.1 - objectLayerMask: - serializedVersion: 2 - m_Bits: 4294967295 - lowestSubdivLevelOverride: 0 - highestSubdivLevelOverride: 7 - overridesSubdivLevels: 0 - mightNeedRebaking: 1 - cachedTransform: - e00: 0 - e01: 0 - e02: 0 - e03: 0 - e10: 0 - e11: 0 - e12: 0 - e13: 0 - e20: 0 - e21: 0 - e22: 0 - e23: 0 - e30: 0 - e31: 0 - e32: 0 - e33: 0 - cachedHashCode: 0 - fillEmptySpaces: 0 ---- !u!4 &1182891855 +--- !u!4 &9304002 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1182891853} + m_GameObject: {fileID: 9304001} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalPosition: {x: 143.71912, y: -38.566196, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 604712594} + m_Father: {fileID: 1908478822} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1256803062 -GameObject: +--- !u!114 &9304003 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1256803065} - - component: {fileID: 1256803064} - - component: {fileID: 1256803063} - m_Layer: 0 - m_Name: EventSystem - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1256803063 -MonoBehaviour: + m_GameObject: {fileID: 9304001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.UniversalAdditionalCameraData + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 0 + m_Cameras: [] + m_RendererIndex: -1 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_VolumeFrameworkUpdateModeOption: 2 + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_ClearDepth: 1 + m_AllowXRRendering: 0 + m_AllowHDROutput: 0 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_TaaSettings: + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 + m_Version: 2 +--- !u!20 &9304004 +Camera: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1256803062} + m_GameObject: {fileID: 9304001} m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3} - m_Name: - m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.UI.InputSystemUIInputModule - m_SendPointerHoverToParent: 1 - m_MoveRepeatDelay: 0.5 - m_MoveRepeatRate: 0.1 - m_XRTrackingOrigin: {fileID: 0} - m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_DeselectOnBackgroundClick: 1 - m_PointerBehavior: 0 - m_CursorLockBehavior: 0 - m_ScrollDeltaPerTick: 6 ---- !u!114 &1256803064 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.08, g: 0.1, b: 0.14, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: -0.3 + width: 1 + height: 0.9 + near clip plane: 0.1 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 8400000, guid: 8888899999aaaaabbbbbcccccdddddee, type: 2} + m_TargetDisplay: 0 + m_TargetEye: 0 + m_HDR: 1 + m_AllowMSAA: 0 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 0 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!114 &9304005 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1256803062} + m_GameObject: {fileID: 9304001} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3} m_Name: - m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.EventSystems.EventSystem - m_FirstSelected: {fileID: 0} - m_sendNavigationEvents: 1 - m_DragThreshold: 10 ---- !u!4 &1256803065 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1256803062} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1827265320 + m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineBrain + ShowDebugText: 0 + ShowCameraFrustum: 0 + IgnoreTimeScale: 0 + WorldUpOverride: {fileID: 0} + ChannelMask: 4 + UpdateMethod: 2 + BlendUpdateMethod: 1 + LensModeOverride: + Enabled: 0 + DefaultMode: 2 + DefaultBlend: + Style: 0 + Time: 0 + CustomCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + CustomBlends: {fileID: 0} +--- !u!1 &9305001 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -808,47 +639,85 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 1827265321} - - component: {fileID: 1827265322} - m_Layer: 0 - m_Name: PlayerSpawner + - component: {fileID: 9305002} + - component: {fileID: 9305003} + - component: {fileID: 9305004} + m_Layer: 5 + m_Name: Car Camera Canvas m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &1827265321 -Transform: +--- !u!224 &9305002 +RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1827265320} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} - m_LocalPosition: {x: 0, y: 1, z: 7} - m_LocalScale: {x: 1, y: 1, z: 1} + m_GameObject: {fileID: 9305001} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.6666667, y: 0.6666667, z: 0.6666667} m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} ---- !u!114 &1827265322 + m_Children: + - {fileID: 9306002} + - {fileID: 9307002} + m_Father: {fileID: 9100000002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 640, y: 360} + m_SizeDelta: {x: 1920, y: 1080} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!223 &9305003 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9305001} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_UseReflectionProbes: 0 + m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 100 + m_TargetDisplay: 0 +--- !u!114 &9305004 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1827265320} + m_GameObject: {fileID: 9305001} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ced7bf28cdbee104e8cdc34ab761b039, type: 3} + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} m_Name: - m_EditorClassIdentifier: PurrNet.Runtime::PurrNet.PlayerSpawner - _playerPrefab: {fileID: 5154484800931780872, guid: 1f6329ff68c80dd46a8bb8e5db77130d, type: 3} - _ignoreNetworkRules: 0 - spawnPoints: - - {fileID: 1827265321} ---- !u!1 &2116198337 + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.CanvasScaler + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1920, y: 1080} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!1 &9306001 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -856,90 +725,127 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 2116198339} - - component: {fileID: 2116198338} - m_Layer: 0 - m_Name: Reflection Probe + - component: {fileID: 9306002} + - component: {fileID: 9306003} + - component: {fileID: 9306004} + - component: {fileID: 9306005} + - component: {fileID: 9306006} + m_Layer: 5 + m_Name: Car View - Left m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!215 &2116198338 -ReflectionProbe: +--- !u!224 &9306002 +RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2116198337} - m_Enabled: 1 - serializedVersion: 2 - m_Type: 0 - m_Mode: 0 - m_RefreshMode: 1 - m_TimeSlicingMode: 0 - m_Resolution: 128 - m_UpdateFrequency: 0 - m_BoxSize: {x: 10, y: 10, z: 10} - m_BoxOffset: {x: 0, y: 0, z: 0} - m_NearClip: 0.3 - m_FarClip: 1000 - m_ShadowDistance: 100 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_CullingMask: - serializedVersion: 2 - m_Bits: 51 - m_IntensityMultiplier: 1 - m_BlendDistance: 3 - m_HDR: 1 - m_BoxProjection: 0 - m_RenderDynamicObjects: 0 - m_UseOcclusionCulling: 1 - m_Importance: 1 - m_CustomBakedTexture: {fileID: 0} ---- !u!4 &2116198339 -Transform: + m_GameObject: {fileID: 9306001} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 9510202} + - {fileID: 9510302} + - {fileID: 9510402} + - {fileID: 9510502} + - {fileID: 9510602} + - {fileID: 9510702} + - {fileID: 9310102} + - {fileID: 9310202} + - {fileID: 9310302} + - {fileID: 9310402} + m_Father: {fileID: 9305002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0.5, y: 0.33333334} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9306003 +CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2116198337} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0.75, z: 0.25} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 604712594} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &285757673750222148 -MeshFilter: + m_GameObject: {fileID: 9306001} + m_CullTransparentMesh: 1 +--- !u!114 &9306004 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6093051471230134716} - m_Mesh: {fileID: -7566841462754083692, guid: cff8f1f32dcb8f743b052f958d40ddc0, type: 3} ---- !u!1 &305272007978442846 -GameObject: + m_GameObject: {fileID: 9306001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: 729c1ad536769c84aaf98bc32c51da8a, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1.5 + height: 1 +--- !u!114 &9306005 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 3521683707466773123} - - component: {fileID: 7218820239248278125} - - component: {fileID: 5059788001672154254} - m_Layer: 2 - m_Name: Back_Part_2 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 - m_IsActive: 1 ---- !u!1 &708799364539981625 + m_GameObject: {fileID: 9306001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 34926a410afc43ab8d16d939096c6720, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::PictureFrameBorder + thickness: 16 + top: {fileID: 9310104} + bottom: {fileID: 9310204} + left: {fileID: 9310304} + right: {fileID: 9310404} +--- !u!114 &9306006 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9306001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b33ce137423c4a3a91f04f7e70fef89c, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::UIParallaxScroller + layers: + - {fileID: 9306004} + - {fileID: 9510204} + - {fileID: 9510304} + - {fileID: 9510404} + - {fileID: 9510504} + - {fileID: 9510604} + scrollRates: + - 0.008 + - 0.014 + - 0.022 + - 0.034 + - 0.05 + - 0.07 + direction: 1 +--- !u!1 &9307001 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -947,86 +853,127 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 4024233217588088173} - - component: {fileID: 7133170251085893050} - - component: {fileID: 2329960007035633681} - m_Layer: 2 - m_Name: Back_Part_1 + - component: {fileID: 9307002} + - component: {fileID: 9307003} + - component: {fileID: 9307004} + - component: {fileID: 9307005} + - component: {fileID: 9307006} + m_Layer: 5 + m_Name: Car View - Right m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &750974001258836848 -Transform: +--- !u!224 &9307002 +RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6093051471230134716} - serializedVersion: 2 - m_LocalRotation: {x: -0.00000028212997, y: -0.0000000437114, z: 0.000000043711378, w: 1} - m_LocalPosition: {x: -0, y: 0, z: -0.0000000027814178} + m_GameObject: {fileID: 9307001} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 3874231289254137071} + m_Children: + - {fileID: 9610202} + - {fileID: 9610302} + - {fileID: 9610402} + - {fileID: 9610502} + - {fileID: 9610602} + - {fileID: 9610702} + - {fileID: 9320102} + - {fileID: 9320202} + - {fileID: 9320302} + - {fileID: 9320402} + m_Father: {fileID: 9305002} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &1172976811987324086 -MeshFilter: + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 1, y: 0.33333334} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9307003 +CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1528205290726672657} - m_Mesh: {fileID: 6889500831704049005, guid: cff8f1f32dcb8f743b052f958d40ddc0, type: 3} ---- !u!4 &1296738678326357226 -Transform: + m_GameObject: {fileID: 9307001} + m_CullTransparentMesh: 1 +--- !u!114 &9307004 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4094583408627704216} - serializedVersion: 2 - m_LocalRotation: {x: -0.00000016292068, y: -0.000000043711395, z: 0.00000004371138, w: 1} - m_LocalPosition: {x: -0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1448501443085806459} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &1448501443085806459 -Transform: + m_GameObject: {fileID: 9307001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: 729c1ad536769c84aaf98bc32c51da8a, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1.5 + height: 1 +--- !u!114 &9307005 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3838825835289551678} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0, y: 0.79499996, z: -0.00000013073299} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 4024233217588088173} - - {fileID: 3521683707466773123} - - {fileID: 6233777116457369307} - - {fileID: 8577614354117532858} - - {fileID: 1296738678326357226} - - {fileID: 6754955248402670120} - - {fileID: 5270582871199435135} - - {fileID: 2355653191682247708} - m_Father: {fileID: 7823694312774259421} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &1507839029914702275 -MeshFilter: + m_GameObject: {fileID: 9307001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 34926a410afc43ab8d16d939096c6720, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::PictureFrameBorder + thickness: 16 + top: {fileID: 9320104} + bottom: {fileID: 9320204} + left: {fileID: 9320304} + right: {fileID: 9320404} +--- !u!114 &9307006 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8177051283744415050} - m_Mesh: {fileID: 1998105296686543947, guid: cff8f1f32dcb8f743b052f958d40ddc0, type: 3} ---- !u!1 &1528205290726672657 + m_GameObject: {fileID: 9307001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b33ce137423c4a3a91f04f7e70fef89c, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::UIParallaxScroller + layers: + - {fileID: 9307004} + - {fileID: 9610204} + - {fileID: 9610304} + - {fileID: 9610404} + - {fileID: 9610504} + - {fileID: 9610604} + scrollRates: + - 0.008 + - 0.014 + - 0.022 + - 0.034 + - 0.05 + - 0.07 + direction: -1 +--- !u!1 &9310101 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1034,81 +981,149 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 2355653191682247708} - - component: {fileID: 1172976811987324086} - - component: {fileID: 7499497021674395898} - m_Layer: 2 - m_Name: Rings + - component: {fileID: 9310102} + - component: {fileID: 9310103} + - component: {fileID: 9310104} + m_Layer: 5 + m_Name: Border - Top m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!23 &2329960007035633681 -MeshRenderer: +--- !u!224 &9310102 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9310101} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9306002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 16} + m_Pivot: {x: 0.5, y: 1} +--- !u!222 &9310103 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9310101} + m_CullTransparentMesh: 1 +--- !u!114 &9310104 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 708799364539981625} + m_GameObject: {fileID: 9310101} m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_ForceMeshLod: -1 - m_MeshLodSelectionBias: 0 - m_RenderingLayerMask: 257 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: b0a1d05e58e6d8b42bec7a5d78210965, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 2 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_GlobalIlluminationMeshLod: 0 - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_MaskInteraction: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!4 &2355653191682247708 -Transform: + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4ea3bf4d5089c784eadc35455a53ca6f, type: 3} + m_Type: 2 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9310201 +GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1528205290726672657} - serializedVersion: 2 - m_LocalRotation: {x: -0.00000016292068, y: -0.000000043711395, z: 0.00000004371138, w: 1} - m_LocalPosition: {x: -0, y: 0, z: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9310202} + - component: {fileID: 9310203} + - component: {fileID: 9310204} + m_Layer: 5 + m_Name: Border - Bottom + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9310202 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9310201} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 1448501443085806459} + m_Father: {fileID: 9306002} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &2373536540347037660 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 16} + m_Pivot: {x: 0.5, y: 0} +--- !u!222 &9310203 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9310201} + m_CullTransparentMesh: 1 +--- !u!114 &9310204 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9310201} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4ea3bf4d5089c784eadc35455a53ca6f, type: 3} + m_Type: 2 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9310301 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1116,32 +1131,74 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 2667994382452280172} - - component: {fileID: 6476517947687084780} - - component: {fileID: 4229607126010098906} - m_Layer: 0 - m_Name: Stand_Part_1 + - component: {fileID: 9310302} + - component: {fileID: 9310303} + - component: {fileID: 9310304} + m_Layer: 5 + m_Name: Border - Left m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &2667994382452280172 -Transform: +--- !u!224 &9310302 +RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2373536540347037660} - serializedVersion: 2 - m_LocalRotation: {x: -0.00000016292068, y: -0.000000043711395, z: 0.00000004371138, w: 1} + m_GameObject: {fileID: 9310301} + m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 3874231289254137071} + m_Father: {fileID: 9306002} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &2850601345607466662 + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 8, y: 0} + m_SizeDelta: {x: 360, y: 16} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9310303 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9310301} + m_CullTransparentMesh: 1 +--- !u!114 &9310304 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9310301} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4ea3bf4d5089c784eadc35455a53ca6f, type: 3} + m_Type: 2 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9310401 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1149,79 +1206,149 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 3874231289254137071} - m_Layer: 0 - m_Name: Stand + - component: {fileID: 9310402} + - component: {fileID: 9310403} + - component: {fileID: 9310404} + m_Layer: 5 + m_Name: Border - Right m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!23 &3274465372524955329 -MeshRenderer: +--- !u!224 &9310402 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9310401} + m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9306002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: -8, y: 0} + m_SizeDelta: {x: 360, y: 16} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9310403 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9310401} + m_CullTransparentMesh: 1 +--- !u!114 &9310404 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8980234965581135787} + m_GameObject: {fileID: 9310401} m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_ForceMeshLod: -1 - m_MeshLodSelectionBias: 0 - m_RenderingLayerMask: 257 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: b0a1d05e58e6d8b42bec7a5d78210965, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 2 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_GlobalIlluminationMeshLod: 0 - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_MaskInteraction: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!4 &3521683707466773123 -Transform: + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4ea3bf4d5089c784eadc35455a53ca6f, type: 3} + m_Type: 2 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9320101 +GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 305272007978442846} - serializedVersion: 2 - m_LocalRotation: {x: -0.00000016292068, y: -0.000000043711395, z: 0.00000004371138, w: 1} - m_LocalPosition: {x: -0, y: 0, z: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9320102} + - component: {fileID: 9320103} + - component: {fileID: 9320104} + m_Layer: 5 + m_Name: Border - Top + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9320102 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9320101} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 1448501443085806459} + m_Father: {fileID: 9307002} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &3838825835289551678 + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 16} + m_Pivot: {x: 0.5, y: 1} +--- !u!222 &9320103 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9320101} + m_CullTransparentMesh: 1 +--- !u!114 &9320104 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9320101} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4ea3bf4d5089c784eadc35455a53ca6f, type: 3} + m_Type: 2 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9320201 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1229,56 +1356,74 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 1448501443085806459} - m_Layer: 0 - m_Name: Ball + - component: {fileID: 9320202} + - component: {fileID: 9320203} + - component: {fileID: 9320204} + m_Layer: 5 + m_Name: Border - Bottom m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &3874231289254137071 -Transform: +--- !u!224 &9320202 +RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2850601345607466662} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0, y: 0, z: -0.0000000027814178} + m_GameObject: {fileID: 9320201} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 750974001258836848} - - {fileID: 2667994382452280172} - - {fileID: 7404782291424719770} - m_Father: {fileID: 7823694312774259421} + m_Children: [] + m_Father: {fileID: 9307002} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &3886155221346378004 -MeshFilter: + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 16} + m_Pivot: {x: 0.5, y: 0} +--- !u!222 &9320203 +CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5519764271386734523} - m_Mesh: {fileID: 2433083544793605448, guid: cff8f1f32dcb8f743b052f958d40ddc0, type: 3} ---- !u!4 &4024233217588088173 -Transform: + m_GameObject: {fileID: 9320201} + m_CullTransparentMesh: 1 +--- !u!114 &9320204 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 708799364539981625} - serializedVersion: 2 - m_LocalRotation: {x: -0.000000011924881, y: -0.00000004371139, z: 0.00000004371139, w: 1} - m_LocalPosition: {x: -0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1448501443085806459} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &4094583408627704216 + m_GameObject: {fileID: 9320201} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4ea3bf4d5089c784eadc35455a53ca6f, type: 3} + m_Type: 2 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9320301 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1286,91 +1431,2985 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 1296738678326357226} - - component: {fileID: 8988423917994663629} - - component: {fileID: 7476877889312545141} - m_Layer: 0 - m_Name: Bottom_Cap + - component: {fileID: 9320302} + - component: {fileID: 9320303} + - component: {fileID: 9320304} + m_Layer: 5 + m_Name: Border - Left m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!23 &4229607126010098906 -MeshRenderer: +--- !u!224 &9320302 +RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2373536540347037660} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_ForceMeshLod: -1 - m_MeshLodSelectionBias: 0 - m_RenderingLayerMask: 257 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 18c2c1244f9fe6b46b934a31bdd446db, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 2 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_GlobalIlluminationMeshLod: 0 - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_MaskInteraction: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!23 &4711151955290684885 -MeshRenderer: + m_GameObject: {fileID: 9320301} + m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9307002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 270} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 8, y: 0} + m_SizeDelta: {x: 360, y: 16} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9320303 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9320301} + m_CullTransparentMesh: 1 +--- !u!114 &9320304 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8177051283744415050} + m_GameObject: {fileID: 9320301} m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4ea3bf4d5089c784eadc35455a53ca6f, type: 3} + m_Type: 2 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9320401 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9320402} + - component: {fileID: 9320403} + - component: {fileID: 9320404} + m_Layer: 5 + m_Name: Border - Right + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9320402 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9320401} + m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9307002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 270} + m_AnchorMin: {x: 1, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: -8, y: 0} + m_SizeDelta: {x: 360, y: 16} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9320403 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9320401} + m_CullTransparentMesh: 1 +--- !u!114 &9320404 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9320401} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4ea3bf4d5089c784eadc35455a53ca6f, type: 3} + m_Type: 2 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9400001 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9400002} + - component: {fileID: 9400003} + m_Layer: 0 + m_Name: Cinemachine Camera - CENTER Overview + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &9400002 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9400001} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 23.219116, y: 54.1338, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 459768754} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &9400003 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9400001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineCamera + Priority: + Enabled: 0 + m_Value: 0 + OutputChannel: 1 + StandbyUpdate: 2 + m_StreamingVersion: 20241001 + m_LegacyPriority: 10 + Target: + TrackingTarget: {fileID: 0} + LookAtTarget: {fileID: 0} + CustomLookAtTarget: 0 + Lens: + FieldOfView: 60 + OrthographicSize: 10 + NearClipPlane: 0.1 + FarClipPlane: 1000 + Dutch: 0 + ModeOverride: 1 + PhysicalProperties: + GateFit: 2 + SensorSize: {x: 21.946, y: 16.002} + LensShift: {x: 0, y: 0} + FocusDistance: 10 + Iso: 200 + ShutterSpeed: 0.005 + Aperture: 16 + BladeCount: 5 + Curvature: {x: 2, y: 11} + BarrelClipping: 0.25 + Anamorphism: 0 + BlendHint: 0 +--- !u!1 &9510201 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9510202} + - component: {fileID: 9510203} + - component: {fileID: 9510204} + m_Layer: 5 + m_Name: Parallax 2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9510202 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510201} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9306002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9510203 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510201} + m_CullTransparentMesh: 1 +--- !u!114 &9510204 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510201} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: 4b9afb2101ca477459a2a102a12e3057, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1.5 + height: 1 +--- !u!1 &9510301 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9510302} + - component: {fileID: 9510303} + - component: {fileID: 9510304} + m_Layer: 5 + m_Name: Parallax 3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9510302 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510301} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9306002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9510303 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510301} + m_CullTransparentMesh: 1 +--- !u!114 &9510304 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510301} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: af2500e673430a44b8e527a33c7f5955, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1.5 + height: 1 +--- !u!1 &9510401 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9510402} + - component: {fileID: 9510403} + - component: {fileID: 9510404} + m_Layer: 5 + m_Name: Parallax 4 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9510402 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510401} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9306002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9510403 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510401} + m_CullTransparentMesh: 1 +--- !u!114 &9510404 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510401} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: 356baad6850f7d049994e2c8607e29cf, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1.5 + height: 1 +--- !u!1 &9510501 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9510502} + - component: {fileID: 9510503} + - component: {fileID: 9510504} + m_Layer: 5 + m_Name: Parallax 5 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9510502 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510501} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9306002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9510503 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510501} + m_CullTransparentMesh: 1 +--- !u!114 &9510504 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510501} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: 2e6e9ac063698bc4b94ed876fea52b89, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1.5 + height: 1 +--- !u!1 &9510601 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9510602} + - component: {fileID: 9510603} + - component: {fileID: 9510604} + m_Layer: 5 + m_Name: Parallax 6 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9510602 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510601} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9306002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9510603 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510601} + m_CullTransparentMesh: 1 +--- !u!114 &9510604 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510601} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: 5567a816406a1d94cbbbaf6808f8c7d7, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1.5 + height: 1 +--- !u!1 &9510701 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9510702} + - component: {fileID: 9510703} + - component: {fileID: 9510704} + m_Layer: 5 + m_Name: RenderTexture Feed + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9510702 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510701} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9306002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9510703 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510701} + m_CullTransparentMesh: 1 +--- !u!114 &9510704 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9510701} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 8400000, guid: 11111222223333344444555556666677, type: 2} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!1 &9610201 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9610202} + - component: {fileID: 9610203} + - component: {fileID: 9610204} + m_Layer: 5 + m_Name: Parallax 2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9610202 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610201} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9307002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9610203 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610201} + m_CullTransparentMesh: 1 +--- !u!114 &9610204 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610201} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: 4b9afb2101ca477459a2a102a12e3057, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1.5 + height: 1 +--- !u!1 &9610301 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9610302} + - component: {fileID: 9610303} + - component: {fileID: 9610304} + m_Layer: 5 + m_Name: Parallax 3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9610302 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610301} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9307002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9610303 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610301} + m_CullTransparentMesh: 1 +--- !u!114 &9610304 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610301} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: af2500e673430a44b8e527a33c7f5955, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1.5 + height: 1 +--- !u!1 &9610401 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9610402} + - component: {fileID: 9610403} + - component: {fileID: 9610404} + m_Layer: 5 + m_Name: Parallax 4 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9610402 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610401} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9307002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9610403 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610401} + m_CullTransparentMesh: 1 +--- !u!114 &9610404 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610401} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: 356baad6850f7d049994e2c8607e29cf, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1.5 + height: 1 +--- !u!1 &9610501 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9610502} + - component: {fileID: 9610503} + - component: {fileID: 9610504} + m_Layer: 5 + m_Name: Parallax 5 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9610502 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610501} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9307002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9610503 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610501} + m_CullTransparentMesh: 1 +--- !u!114 &9610504 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610501} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: 2e6e9ac063698bc4b94ed876fea52b89, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1.5 + height: 1 +--- !u!1 &9610601 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9610602} + - component: {fileID: 9610603} + - component: {fileID: 9610604} + m_Layer: 5 + m_Name: Parallax 6 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9610602 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610601} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9307002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9610603 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610601} + m_CullTransparentMesh: 1 +--- !u!114 &9610604 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610601} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: 5567a816406a1d94cbbbaf6808f8c7d7, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1.5 + height: 1 +--- !u!1 &9610701 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9610702} + - component: {fileID: 9610703} + - component: {fileID: 9610704} + m_Layer: 5 + m_Name: RenderTexture Feed + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9610702 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610701} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9307002} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9610703 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610701} + m_CullTransparentMesh: 1 +--- !u!114 &9610704 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9610701} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 8400000, guid: 8888899999aaaaabbbbbcccccdddddee, type: 2} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!1 &228694775 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 228694777} + - component: {fileID: 228694776} + m_Layer: 0 + m_Name: CENTER + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &228694776 +SpriteRenderer: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 228694775} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_MaskInteraction: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_SpriteSortPoint: 0 + m_BlendShapeWeights: [] +--- !u!4 &228694777 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 228694775} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 23.219116, y: 54.1338, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 459768754} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &247965891 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 247965892} + - component: {fileID: 247965893} + m_Layer: 0 + m_Name: sport car(h)art + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &247965892 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 247965891} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} + m_LocalPosition: {x: -0.009, y: 0.04, z: 0} + m_LocalScale: {x: 0.31176317, y: 0.89791393, z: 0.66059} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 314779088} + m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} +--- !u!212 &247965893 +SpriteRenderer: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 247965891} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -1 + m_MaskInteraction: 0 + m_Sprite: {fileID: -3075405512548146508, guid: 2ebe45c98416c514e975567270b9bd69, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 6.5, y: 1.99} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_SpriteSortPoint: 0 + m_BlendShapeWeights: [] +--- !u!1 &314779085 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 314779088} + - component: {fileID: 314779089} + - component: {fileID: 314779091} + m_Layer: 0 + m_Name: Car + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &314779088 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 314779085} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -35.63153, y: -12.24, z: 0} + m_LocalScale: {x: 4.237768, y: 1.4713882, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 247965892} + - {fileID: 1152604149} + - {fileID: 1147351674} + - {fileID: 1462917632} + - {fileID: 511773342} + m_Father: {fileID: 1787493463} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!61 &314779089 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 314779085} + m_Enabled: 1 + serializedVersion: 3 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_CompositeOperation: 0 + m_CompositeOrder: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 +--- !u!114 &314779091 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 314779085} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b7024684365a4c7a92335f93ad10c86a, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::CarDrawingWheelInstaller + chassisMass: 4 + wheelRadius: 0.5 + wheelMass: 1 + wheelFriction: 0.9 + suspensionFrequency: 5 + suspensionDamping: 0.8 +--- !u!1 &415455849 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 415455853} + - component: {fileID: 415455852} + - component: {fileID: 415455851} + - component: {fileID: 415455850} + m_Layer: 0 + m_Name: Closed Sprite Shape + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!68 &415455850 +EdgeCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415455849} + m_Enabled: 1 + serializedVersion: 3 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_CompositeOperation: 0 + m_CompositeOrder: 0 + m_Offset: {x: 0, y: 0} + m_EdgeRadius: 0 + m_Points: + - {x: -5.003333, y: -3.3422937} + - {x: -5.110631, y: -3.304809} + - {x: -6.786085, y: -2.4405499} + - {x: -7.0885067, y: -1.9698541} + - {x: -7.2780857, y: -1.5505934} + - {x: -7.415951, y: -1.1446314} + - {x: -7.5212097, y: -0.7351297} + - {x: -7.5993586, y: -0.3154977} + - {x: -7.6501513, y: 0.11747658} + - {x: -7.669237, y: 0.5680188} + - {x: -7.6463194, y: 1.0453583} + - {x: -7.557925, y: 1.5680745} + - {x: -7.348653, y: 2.1628642} + - {x: -6.904482, y: 2.8239276} + - {x: -6.1184483, y: 3.3918667} + - {x: -5.340022, y: 3.5932078} + - {x: -3.4738486, y: 3.6633487} + - {x: -1.4055395, y: 3.753882} + - {x: 1.0492303, y: 3.8688283} + - {x: 3.5804057, y: 3.9936295} + - {x: 5.8784513, y: 4.11372} + - {x: 7.628721, y: 4.214177} + - {x: 8.463228, y: 4.274708} + - {x: 9.058515, y: 4.3588357} + - {x: 9.840604, y: 4.4989414} + - {x: 10.267832, y: 4.5879908} + - {x: 10.705703, y: 4.688881} + - {x: 11.144047, y: 4.8007584} + - {x: 11.572385, y: 4.922435} + - {x: 11.979661, y: 5.052157} + - {x: 12.3539505, y: 5.1872115} + - {x: 12.682038, y: 5.323183} + - {x: 12.948947, y: 5.452565} + - {x: 13.230936, y: 5.627757} + - {x: 13.8869095, y: 6.135394} + - {x: 17.703407, y: 6.730076} + - {x: 21.997522, y: 6.89135} + - {x: 25.863338, y: 7.0345755} + - {x: 38.13888, y: 7.239144} + - {x: 53.846542, y: 7.35421} + - {x: 72.2457, y: 7.3855076} + - {x: 92.58926, y: 7.3384886} + - {x: 114.1284, y: 7.218548} + - {x: 136.11386, y: 7.0310745} + - {x: 157.79616, y: 6.7814407} + - {x: 178.426, y: 6.475013} + - {x: 197.25461, y: 6.117132} + - {x: 213.53477, y: 5.7130604} + - {x: 226.52478, y: 5.267707} + - {x: 235.52107, y: 4.782258} + - {x: 239.65433, y: 4.27036} + - {x: 239.97482, y: 4.2099314} + - {x: 240.88858, y: 3.8272204} + - {x: 241.58682, y: 3.3531928} + - {x: 242.19351, y: 2.64272} + - {x: 242.5456, y: 1.7020102} + - {x: 242.53606, y: 0.7565907} + - {x: 242.2893, y: 0.008717418} + - {x: 241.96353, y: -0.5404804} + - {x: 241.62839, y: -0.96006775} + - {x: 241.30577, y: -1.3000557} + - {x: 240.46043, y: -2.0968952} + - {x: 240.50455, y: -2.026975} + - {x: 239.86932, y: -2.7662458} + - {x: 235.92868, y: -3.393897} + - {x: 227.7781, y: -3.6080213} + - {x: 215.337, y: -3.760085} + - {x: 199.34561, y: -3.859819} + - {x: 180.58948, y: -3.91435} + - {x: 159.85895, y: -3.930667} + - {x: 137.94531, y: -3.9157333} + - {x: 115.640564, y: -3.876509} + - {x: 93.736694, y: -3.8199492} + - {x: 73.02582, y: -3.7530103} + - {x: 54.300125, y: -3.6826477} + - {x: 38.35184, y: -3.615817} + - {x: 25.973171, y: -3.559474} + - {x: 17.956402, y: -3.5205727} + - {x: 14.746454, y: -3.5040445} + - {x: -3.904505, y: -3.3503566} + - {x: -5.003333, y: -3.3422937} + m_AdjacentStartPoint: {x: 0, y: 0} + m_AdjacentEndPoint: {x: 0, y: 0} + m_UseAdjacentStartPoint: 0 + m_UseAdjacentEndPoint: 0 +--- !u!114 &415455851 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415455849} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Spline: + m_IsOpenEnded: 0 + m_ControlPoints: + - position: {x: -5.0015287, y: -1.3354588, z: 0} + leftTangent: {x: 0.53597355, y: -0.00048208237, z: 0} + rightTangent: {x: -0.5359726, y: 0.00048208237, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + - position: {x: -5.1149626, y: 1.5990314, z: 0} + leftTangent: {x: -1.0023327, y: 0.0010559559, z: 0} + rightTangent: {x: 1.0023327, y: -0.0010559559, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + - position: {x: 8.677605, y: 2.2793548, z: 0} + leftTangent: {x: -0.99381924, y: -0.116232395, z: 0} + rightTangent: {x: 1.4870434, y: 0.17391849, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + - position: {x: 14.76697, y: 4.3318186, z: 0} + leftTangent: {x: -0.9865799, y: -1.1743755, z: 0} + rightTangent: {x: 1.8898907, y: 2.249632, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + - position: {x: 239.44629, y: 2.2739449, z: 0} + leftTangent: {x: -7.2540894, y: 2.6124268, z: 0} + rightTangent: {x: 2.8207397, y: -1.0154762, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + - position: {x: 238.73047, y: -1.1138382, z: 0} + leftTangent: {x: 0.21255493, y: 0.77015877, z: 0} + rightTangent: {x: -0.42971802, y: -1.5609894, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + - position: {x: 15.104106, y: -1.4992604, z: 0} + leftTangent: {x: 0.10578823, y: 0.00008201599, z: 0} + rightTangent: {x: -0.5439148, y: -0.00042247772, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + m_SpriteShape: {fileID: 11400000, guid: 867df6263b84e2f42a2f75aed687e3ed, type: 2} + m_FillPixelPerUnit: 256 + m_StretchTiling: 1 + m_SplineDetail: 16 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_CornerAngleThreshold: 30 + m_ColliderDetail: 16 + m_ColliderOffset: 0.5 + m_UpdateCollider: 1 + m_EnableTangents: 0 + m_GeometryCached: 0 + m_UTess2D: 1 + m_UpdateShadow: 0 + m_ShadowDetail: 16 + m_ShadowOffset: 0.5 + m_BoundsScale: 2 + m_UpdateGeometry: 1 + m_Creator: {fileID: 0} + m_Modifiers: [] + m_ColliderSegment: + - {x: -5.003333, y: -3.3422937} + - {x: -5.110631, y: -3.304809} + - {x: -6.786085, y: -2.4405499} + - {x: -7.0885067, y: -1.9698541} + - {x: -7.2780857, y: -1.5505934} + - {x: -7.415951, y: -1.1446314} + - {x: -7.5212097, y: -0.7351297} + - {x: -7.5993586, y: -0.3154977} + - {x: -7.6501513, y: 0.11747658} + - {x: -7.669237, y: 0.5680188} + - {x: -7.6463194, y: 1.0453583} + - {x: -7.557925, y: 1.5680745} + - {x: -7.348653, y: 2.1628642} + - {x: -6.904482, y: 2.8239276} + - {x: -6.1184483, y: 3.3918667} + - {x: -5.340022, y: 3.5932078} + - {x: -3.4738486, y: 3.6633487} + - {x: -1.4055395, y: 3.753882} + - {x: 1.0492303, y: 3.8688283} + - {x: 3.5804057, y: 3.9936295} + - {x: 5.8784513, y: 4.11372} + - {x: 7.628721, y: 4.214177} + - {x: 8.463228, y: 4.274708} + - {x: 9.058515, y: 4.3588357} + - {x: 9.840604, y: 4.4989414} + - {x: 10.267832, y: 4.5879908} + - {x: 10.705703, y: 4.688881} + - {x: 11.144047, y: 4.8007584} + - {x: 11.572385, y: 4.922435} + - {x: 11.979661, y: 5.052157} + - {x: 12.3539505, y: 5.1872115} + - {x: 12.682038, y: 5.323183} + - {x: 12.948947, y: 5.452565} + - {x: 13.230936, y: 5.627757} + - {x: 13.8869095, y: 6.135394} + - {x: 17.703407, y: 6.730076} + - {x: 21.997522, y: 6.89135} + - {x: 25.863338, y: 7.0345755} + - {x: 38.13888, y: 7.239144} + - {x: 53.846542, y: 7.35421} + - {x: 72.2457, y: 7.3855076} + - {x: 92.58926, y: 7.3384886} + - {x: 114.1284, y: 7.218548} + - {x: 136.11386, y: 7.0310745} + - {x: 157.79616, y: 6.7814407} + - {x: 178.426, y: 6.475013} + - {x: 197.25461, y: 6.117132} + - {x: 213.53477, y: 5.7130604} + - {x: 226.52478, y: 5.267707} + - {x: 235.52107, y: 4.782258} + - {x: 239.65433, y: 4.27036} + - {x: 239.97482, y: 4.2099314} + - {x: 240.88858, y: 3.8272204} + - {x: 241.58682, y: 3.3531928} + - {x: 242.19351, y: 2.64272} + - {x: 242.5456, y: 1.7020102} + - {x: 242.53606, y: 0.7565907} + - {x: 242.2893, y: 0.008717418} + - {x: 241.96353, y: -0.5404804} + - {x: 241.62839, y: -0.96006775} + - {x: 241.30577, y: -1.3000557} + - {x: 240.46043, y: -2.0968952} + - {x: 240.50455, y: -2.026975} + - {x: 239.86932, y: -2.7662458} + - {x: 235.92868, y: -3.393897} + - {x: 227.7781, y: -3.6080213} + - {x: 215.337, y: -3.760085} + - {x: 199.34561, y: -3.859819} + - {x: 180.58948, y: -3.91435} + - {x: 159.85895, y: -3.930667} + - {x: 137.94531, y: -3.9157333} + - {x: 115.640564, y: -3.876509} + - {x: 93.736694, y: -3.8199492} + - {x: 73.02582, y: -3.7530103} + - {x: 54.300125, y: -3.6826477} + - {x: 38.35184, y: -3.615817} + - {x: 25.973171, y: -3.559474} + - {x: 17.956402, y: -3.5205727} + - {x: 14.746454, y: -3.5040445} + - {x: -3.904505, y: -3.3503566} + - {x: -5.003333, y: -3.3422937} + m_ShadowSegment: [] +--- !u!1971053207 &415455852 +SpriteShapeRenderer: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415455849} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_MaskInteraction: 0 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_ShapeTexture: {fileID: 2800000, guid: a9b763119a18c294f81d70af36a7745d, type: 3} + m_Sprites: + - {fileID: 21300000, guid: 80f11d54b03c9a54296a025ca4739e1c, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + m_LocalAABB: + m_Center: {x: 117.43819, y: 1.7274203, z: 0} + m_Extent: {x: 125.10742, y: 5.6580873, z: 0} + m_SpriteSortPoint: 0 +--- !u!4 &415455853 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 415455849} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -35.90001, y: -18.500002, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1787493463} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &459768753 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 459768754} + m_Layer: 0 + m_Name: Court Scene + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &459768754 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 459768753} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -123.21912, y: -34.1338, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 9400002} + - {fileID: 228694777} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &511773341 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 511773342} + - component: {fileID: 511773344} + - component: {fileID: 511773343} + - component: {fileID: 511773345} + - component: {fileID: 511773346} + m_Layer: 0 + m_Name: Wheel 2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &511773342 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511773341} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.26572952, y: -0.88691753, z: 0} + m_LocalScale: {x: 0.23597327, y: 0.6796303, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 314779088} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!60 &511773343 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511773341} + m_Enabled: 1 + serializedVersion: 3 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_CompositeOperation: 0 + m_CompositeOrder: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: 0, y: 0.5} + - {x: -0.15234375, y: 0.47265625} + - {x: -0.29296875, y: 0.40234375} + - {x: -0.40234375, y: 0.29296875} + - {x: -0.47265625, y: 0.15234375} + - {x: -0.5, y: 0} + - {x: -0.47265625, y: -0.15234375} + - {x: -0.40234375, y: -0.29296875} + - {x: -0.29296875, y: -0.40234375} + - {x: -0.15234375, y: -0.47265625} + - {x: 0, y: -0.5} + - {x: 0.15234375, y: -0.47265625} + - {x: 0.29296875, y: -0.40234375} + - {x: 0.40234375, y: -0.29296875} + - {x: 0.47265625, y: -0.15234375} + - {x: 0.5, y: 0} + - {x: 0.47265625, y: 0.15234375} + - {x: 0.40234375, y: 0.29296875} + - {x: 0.29296875, y: 0.40234375} + - {x: 0.15234375, y: 0.47265625} + m_UseDelaunayMesh: 1 +--- !u!212 &511773344 +SpriteRenderer: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511773341} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_MaskInteraction: 0 + m_Sprite: {fileID: -2413806693520163455, guid: a86470a33a6bf42c4b3595704624658b, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_SpriteSortPoint: 0 + m_BlendShapeWeights: [] +--- !u!114 &511773345 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511773341} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0913a6f6f3b12c74584e8d20d982018f, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::WheelSpinner + rotationSpeed: -360 + maximumTorque: 20 + acceleration: 0.05 +--- !u!50 &511773346 +Rigidbody2D: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 511773341} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDamping: 0 + m_AngularDamping: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!1 &601401178 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 601401179} + - component: {fileID: 601401183} + - component: {fileID: 601401182} + - component: {fileID: 601401181} + - component: {fileID: 601401180} + m_Layer: 0 + m_Name: Wheel 2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &601401179 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 601401178} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.26572952, y: -0.88691753, z: 0} + m_LocalScale: {x: 0.23597327, y: 0.6796303, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2130553444} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!50 &601401180 +Rigidbody2D: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 601401178} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDamping: 0 + m_AngularDamping: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!114 &601401181 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 601401178} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0913a6f6f3b12c74584e8d20d982018f, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::WheelSpinner + rotationSpeed: 360 + maximumTorque: 20 + acceleration: 0.05 +--- !u!60 &601401182 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 601401178} + m_Enabled: 1 + serializedVersion: 3 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_CompositeOperation: 0 + m_CompositeOrder: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: 0, y: 0.5} + - {x: -0.15234375, y: 0.47265625} + - {x: -0.29296875, y: 0.40234375} + - {x: -0.40234375, y: 0.29296875} + - {x: -0.47265625, y: 0.15234375} + - {x: -0.5, y: 0} + - {x: -0.47265625, y: -0.15234375} + - {x: -0.40234375, y: -0.29296875} + - {x: -0.29296875, y: -0.40234375} + - {x: -0.15234375, y: -0.47265625} + - {x: 0, y: -0.5} + - {x: 0.15234375, y: -0.47265625} + - {x: 0.29296875, y: -0.40234375} + - {x: 0.40234375, y: -0.29296875} + - {x: 0.47265625, y: -0.15234375} + - {x: 0.5, y: 0} + - {x: 0.47265625, y: 0.15234375} + - {x: 0.40234375, y: 0.29296875} + - {x: 0.29296875, y: 0.40234375} + - {x: 0.15234375, y: 0.47265625} + m_UseDelaunayMesh: 1 +--- !u!212 &601401183 +SpriteRenderer: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 601401178} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_MaskInteraction: 0 + m_Sprite: {fileID: -2413806693520163455, guid: a86470a33a6bf42c4b3595704624658b, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_SpriteSortPoint: 0 + m_BlendShapeWeights: [] +--- !u!1 &826997154 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 826997158} + - component: {fileID: 826997157} + - component: {fileID: 826997156} + - component: {fileID: 826997155} + m_Layer: 0 + m_Name: Closed Sprite Shape (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!68 &826997155 +EdgeCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 826997154} + m_Enabled: 1 + serializedVersion: 3 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_CompositeOperation: 0 + m_CompositeOrder: 0 + m_Offset: {x: 0, y: 0} + m_EdgeRadius: 0 + m_Points: + - {x: -171.25967, y: -10.49493} + - {x: -171.36615, y: -10.395208} + - {x: -173.39243, y: -8.675454} + - {x: -173.5358, y: -8.052049} + - {x: -173.6414, y: -7.3913426} + - {x: -173.72723, y: -6.6658325} + - {x: -173.79588, y: -5.884387} + - {x: -173.84613, y: -5.0655837} + - {x: -173.87595, y: -4.2312303} + - {x: -173.88242, y: -3.4030046} + - {x: -173.86179, y: -2.6003423} + - {x: -173.8081, y: -1.8358756} + - {x: -173.70734, y: -1.1042562} + - {x: -173.50812, y: -0.3454786} + - {x: -172.92664, y: 0.6284127} + - {x: -171.81845, y: 1.2712145} + - {x: -168.87967, y: 1.3737655} + - {x: -162.33514, y: 1.4753847} + - {x: -148.69962, y: 1.6903641} + - {x: -139.49066, y: 1.8362944} + - {x: -124.45006, y: 2.0758376} + - {x: -107.83638, y: 2.3416147} + - {x: -90.27881, y: 2.623757} + - {x: -72.40681, y: 2.9123971} + - {x: -54.849575, y: 3.1976664} + - {x: -38.23648, y: 3.469696} + - {x: -23.196873, y: 3.7186172} + - {x: -10.360201, y: 3.9345593} + - {x: -0.35627842, y: 4.107644} + - {x: 6.1817274, y: 4.227925} + - {x: 8.52541, y: 4.2804117} + - {x: 9.058515, y: 4.3588357} + - {x: 9.840604, y: 4.4989414} + - {x: 10.267832, y: 4.5879908} + - {x: 10.705703, y: 4.688881} + - {x: 11.144047, y: 4.8007584} + - {x: 11.572385, y: 4.922435} + - {x: 11.979661, y: 5.052157} + - {x: 12.3539505, y: 5.1872115} + - {x: 12.682038, y: 5.323183} + - {x: 12.948947, y: 5.452565} + - {x: 13.230936, y: 5.627757} + - {x: 13.622, y: 5.9799795} + - {x: 15.074677, y: 6.671371} + - {x: 17.32407, y: 7.140894} + - {x: 20.255163, y: 7.510803} + - {x: 23.86041, y: 7.825575} + - {x: 28.02488, y: 8.08758} + - {x: 32.614227, y: 8.294254} + - {x: 37.488388, y: 8.441898} + - {x: 42.505356, y: 8.52645} + - {x: 47.52246, y: 8.543665} + - {x: 52.397293, y: 8.489155} + - {x: 56.988632, y: 8.358296} + - {x: 61.158257, y: 8.1458845} + - {x: 64.77617, y: 7.844823} + - {x: 65.91878, y: 7.6900043} + - {x: 67.73947, y: 7.4393997} + - {x: 70.49458, y: 6.605489} + - {x: 71.381035, y: 4.208973} + - {x: 69.616844, y: 2.5666213} + - {x: 68.121765, y: 2.0856237} + - {x: 66.237885, y: 1.609401} + - {x: 63.96806, y: 1.1030363} + - {x: 61.39931, y: 0.5717869} + - {x: 58.634132, y: 0.026425421} + - {x: 55.77991, y: -0.5208286} + - {x: 50.243523, y: -1.5696082} + - {x: 47.78486, y: -2.0445335} + - {x: 45.686653, y: -2.4675314} + - {x: 44.07965, y: -2.8202214} + - {x: 43.206657, y: -3.042482} + - {x: 43.080013, y: -3.1092238} + - {x: 42.43289, y: -3.494394} + - {x: 40.941216, y: -3.825067} + - {x: 39.262077, y: -3.9791193} + - {x: 37.24607, y: -4.0645657} + - {x: 34.93898, y: -4.0989566} + - {x: 32.418564, y: -4.0921116} + - {x: 29.771404, y: -4.05243} + - {x: 27.087395, y: -3.9879432} + - {x: 24.457832, y: -3.906561} + - {x: 21.974766, y: -3.816152} + - {x: 19.730642, y: -3.7245674} + - {x: 17.818169, y: -3.6396527} + - {x: 15.361777, y: -3.521318} + - {x: 15.090752, y: -3.5060525} + - {x: 12.715248, y: -3.5938683} + - {x: 5.9845247, y: -3.8444543} + - {x: -4.3597803, y: -4.2317357} + - {x: -17.73077, y: -4.733492} + - {x: -33.25923, y: -5.3168955} + - {x: -109.801575, y: -8.195173} + - {x: -122.7491, y: -8.681903} + - {x: -140.492, y: -9.34835} + - {x: -151.64746, y: -9.76691} + - {x: -161.9913, y: -10.154093} + - {x: -168.7233, y: -10.404628} + - {x: -171.25967, y: -10.49493} + m_AdjacentStartPoint: {x: 0, y: 0} + m_AdjacentEndPoint: {x: 0, y: 0} + m_UseAdjacentStartPoint: 0 + m_UseAdjacentEndPoint: 0 +--- !u!114 &826997156 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 826997154} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Spline: + m_IsOpenEnded: 0 + m_ControlPoints: + - position: {x: -171.25784, y: -8.488094, z: 0} + leftTangent: {x: 0.5359497, y: -0.00048065186, z: 0} + rightTangent: {x: -0.53601074, y: 0.00048828125, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + - position: {x: -171.3048, y: -0.66877365, z: 0} + leftTangent: {x: -1.0023193, y: 0.0010528564, z: 0} + rightTangent: {x: 1.0023499, y: -0.0010566711, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + - position: {x: 8.677605, y: 2.2793548, z: 0} + leftTangent: {x: -0.99381924, y: -0.116232395, z: 0} + rightTangent: {x: 1.4870434, y: 0.17391849, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + - position: {x: 14.76697, y: 4.3318186, z: 0} + leftTangent: {x: -0.9865799, y: -1.1743755, z: 0} + rightTangent: {x: 1.8898907, y: 2.249632, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + - position: {x: 69.29965, y: 4.993181, z: 0} + leftTangent: {x: -7.254051, y: 2.6124268, z: 0} + rightTangent: {x: 2.820755, y: -1.015476, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + - position: {x: 42.090847, y: -1.3631024, z: 0} + leftTangent: {x: 0.21257782, y: 0.7701602, z: 0} + rightTangent: {x: -0.42969513, y: -1.5609894, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + - position: {x: 15.104106, y: -1.4992604, z: 0} + leftTangent: {x: 0.10578823, y: 0.00008201599, z: 0} + rightTangent: {x: -0.5439148, y: -0.00042247772, z: 0} + mode: 1 + height: 1 + spriteIndex: 0 + corner: 1 + m_CornerMode: 1 + m_SpriteShape: {fileID: 11400000, guid: 867df6263b84e2f42a2f75aed687e3ed, type: 2} + m_FillPixelPerUnit: 256 + m_StretchTiling: 1 + m_SplineDetail: 16 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_CornerAngleThreshold: 30 + m_ColliderDetail: 16 + m_ColliderOffset: 0.5 + m_UpdateCollider: 1 + m_EnableTangents: 0 + m_GeometryCached: 0 + m_UTess2D: 1 + m_UpdateShadow: 0 + m_ShadowDetail: 16 + m_ShadowOffset: 0.5 + m_BoundsScale: 2 + m_UpdateGeometry: 1 + m_Creator: {fileID: 0} + m_Modifiers: [] + m_ColliderSegment: + - {x: -171.25967, y: -10.49493} + - {x: -171.36615, y: -10.395208} + - {x: -173.39243, y: -8.675454} + - {x: -173.5358, y: -8.052049} + - {x: -173.6414, y: -7.3913426} + - {x: -173.72723, y: -6.6658325} + - {x: -173.79588, y: -5.884387} + - {x: -173.84613, y: -5.0655837} + - {x: -173.87595, y: -4.2312303} + - {x: -173.88242, y: -3.4030046} + - {x: -173.86179, y: -2.6003423} + - {x: -173.8081, y: -1.8358756} + - {x: -173.70734, y: -1.1042562} + - {x: -173.50812, y: -0.3454786} + - {x: -172.92664, y: 0.6284127} + - {x: -171.81845, y: 1.2712145} + - {x: -168.87967, y: 1.3737655} + - {x: -162.33514, y: 1.4753847} + - {x: -148.69962, y: 1.6903641} + - {x: -139.49066, y: 1.8362944} + - {x: -124.45006, y: 2.0758376} + - {x: -107.83638, y: 2.3416147} + - {x: -90.27881, y: 2.623757} + - {x: -72.40681, y: 2.9123971} + - {x: -54.849575, y: 3.1976664} + - {x: -38.23648, y: 3.469696} + - {x: -23.196873, y: 3.7186172} + - {x: -10.360201, y: 3.9345593} + - {x: -0.35627842, y: 4.107644} + - {x: 6.1817274, y: 4.227925} + - {x: 8.52541, y: 4.2804117} + - {x: 9.058515, y: 4.3588357} + - {x: 9.840604, y: 4.4989414} + - {x: 10.267832, y: 4.5879908} + - {x: 10.705703, y: 4.688881} + - {x: 11.144047, y: 4.8007584} + - {x: 11.572385, y: 4.922435} + - {x: 11.979661, y: 5.052157} + - {x: 12.3539505, y: 5.1872115} + - {x: 12.682038, y: 5.323183} + - {x: 12.948947, y: 5.452565} + - {x: 13.230936, y: 5.627757} + - {x: 13.622, y: 5.9799795} + - {x: 15.074677, y: 6.671371} + - {x: 17.32407, y: 7.140894} + - {x: 20.255163, y: 7.510803} + - {x: 23.86041, y: 7.825575} + - {x: 28.02488, y: 8.08758} + - {x: 32.614227, y: 8.294254} + - {x: 37.488388, y: 8.441898} + - {x: 42.505356, y: 8.52645} + - {x: 47.52246, y: 8.543665} + - {x: 52.397293, y: 8.489155} + - {x: 56.988632, y: 8.358296} + - {x: 61.158257, y: 8.1458845} + - {x: 64.77617, y: 7.844823} + - {x: 65.91878, y: 7.6900043} + - {x: 67.73947, y: 7.4393997} + - {x: 70.49458, y: 6.605489} + - {x: 71.381035, y: 4.208973} + - {x: 69.616844, y: 2.5666213} + - {x: 68.121765, y: 2.0856237} + - {x: 66.237885, y: 1.609401} + - {x: 63.96806, y: 1.1030363} + - {x: 61.39931, y: 0.5717869} + - {x: 58.634132, y: 0.026425421} + - {x: 55.77991, y: -0.5208286} + - {x: 50.243523, y: -1.5696082} + - {x: 47.78486, y: -2.0445335} + - {x: 45.686653, y: -2.4675314} + - {x: 44.07965, y: -2.8202214} + - {x: 43.206657, y: -3.042482} + - {x: 43.080013, y: -3.1092238} + - {x: 42.43289, y: -3.494394} + - {x: 40.941216, y: -3.825067} + - {x: 39.262077, y: -3.9791193} + - {x: 37.24607, y: -4.0645657} + - {x: 34.93898, y: -4.0989566} + - {x: 32.418564, y: -4.0921116} + - {x: 29.771404, y: -4.05243} + - {x: 27.087395, y: -3.9879432} + - {x: 24.457832, y: -3.906561} + - {x: 21.974766, y: -3.816152} + - {x: 19.730642, y: -3.7245674} + - {x: 17.818169, y: -3.6396527} + - {x: 15.361777, y: -3.521318} + - {x: 15.090752, y: -3.5060525} + - {x: 12.715248, y: -3.5938683} + - {x: 5.9845247, y: -3.8444543} + - {x: -4.3597803, y: -4.2317357} + - {x: -17.73077, y: -4.733492} + - {x: -33.25923, y: -5.3168955} + - {x: -109.801575, y: -8.195173} + - {x: -122.7491, y: -8.681903} + - {x: -140.492, y: -9.34835} + - {x: -151.64746, y: -9.76691} + - {x: -161.9913, y: -10.154093} + - {x: -168.7233, y: -10.404628} + - {x: -171.25967, y: -10.49493} + m_ShadowSegment: [] +--- !u!1971053207 &826997157 +SpriteShapeRenderer: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 826997154} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_MaskInteraction: 0 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_ShapeTexture: {fileID: 2800000, guid: a9b763119a18c294f81d70af36a7745d, type: 3} + m_Sprites: + - {fileID: 21300000, guid: 80f11d54b03c9a54296a025ca4739e1c, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + - {fileID: 21300000, guid: 608e61deb05c54660bebf5a4dd2ee02d, type: 3} + m_LocalAABB: + m_Center: {x: -51.250687, y: -0.97563267, z: 0} + m_Extent: {x: 122.631714, y: 9.519298, z: 0} + m_SpriteSortPoint: 0 +--- !u!4 &826997158 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 826997154} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 80.11912, y: -48.8662, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1908478822} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &961739749 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 961739753} + - component: {fileID: 961739752} + - component: {fileID: 961739751} + - component: {fileID: 961739750} + - component: {fileID: 961739755} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &961739750 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 961739749} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 0 + m_Cameras: [] + m_RendererIndex: -1 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_VolumeFrameworkUpdateModeOption: 2 + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_ClearDepth: 1 + m_AllowXRRendering: 1 + m_AllowHDROutput: 1 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_TaaSettings: + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 + m_Version: 2 +--- !u!81 &961739751 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 961739749} + m_Enabled: 1 +--- !u!20 &961739752 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 961739749} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 10.991284 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 21.946, y: 16.002} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.1 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 10 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 0 + m_HDR: 1 + m_AllowMSAA: 0 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 0 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &961739753 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 961739749} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -100, y: 20, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &961739755 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 961739749} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineBrain + ShowDebugText: 0 + ShowCameraFrustum: 1 + IgnoreTimeScale: 0 + WorldUpOverride: {fileID: 0} + ChannelMask: 1 + UpdateMethod: 2 + BlendUpdateMethod: 1 + LensModeOverride: + Enabled: 0 + DefaultMode: 2 + DefaultBlend: + Style: 1 + Time: 2 + CustomCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + CustomBlends: {fileID: 0} +--- !u!1 &1060515554 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1060515555} + - component: {fileID: 1060515559} + - component: {fileID: 1060515558} + - component: {fileID: 1060515557} + - component: {fileID: 1060515556} + m_Layer: 0 + m_Name: Wheel 1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1060515555 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1060515554} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.24732359, y: -0.88691753, z: 0} + m_LocalScale: {x: 0.23597327, y: 0.6796303, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2130553444} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!50 &1060515556 +Rigidbody2D: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1060515554} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDamping: 0 + m_AngularDamping: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!114 &1060515557 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1060515554} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0913a6f6f3b12c74584e8d20d982018f, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::WheelSpinner + rotationSpeed: 360 + maximumTorque: 20 + acceleration: 0.05 +--- !u!60 &1060515558 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1060515554} + m_Enabled: 1 + serializedVersion: 3 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_CompositeOperation: 0 + m_CompositeOrder: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: 0, y: 0.5} + - {x: -0.15234375, y: 0.47265625} + - {x: -0.29296875, y: 0.40234375} + - {x: -0.40234375, y: 0.29296875} + - {x: -0.47265625, y: 0.15234375} + - {x: -0.5, y: 0} + - {x: -0.47265625, y: -0.15234375} + - {x: -0.40234375, y: -0.29296875} + - {x: -0.29296875, y: -0.40234375} + - {x: -0.15234375, y: -0.47265625} + - {x: 0, y: -0.5} + - {x: 0.15234375, y: -0.47265625} + - {x: 0.29296875, y: -0.40234375} + - {x: 0.40234375, y: -0.29296875} + - {x: 0.47265625, y: -0.15234375} + - {x: 0.5, y: 0} + - {x: 0.47265625, y: 0.15234375} + - {x: 0.40234375, y: 0.29296875} + - {x: 0.29296875, y: 0.40234375} + - {x: 0.15234375, y: 0.47265625} + m_UseDelaunayMesh: 1 +--- !u!212 &1060515559 +SpriteRenderer: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1060515554} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 m_ForceMeshLod: -1 m_MeshLodSelectionBias: 0 - m_RenderingLayerMask: 257 + m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 18c2c1244f9fe6b46b934a31bdd446db, type: 2} + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -1378,12 +4417,12 @@ MeshRenderer: m_ProbeAnchor: {fileID: 0} m_LightProbeVolumeOverride: {fileID: 0} m_ScaleInLightmap: 1 - m_ReceiveGI: 2 + m_ReceiveGI: 1 m_PreserveUVs: 0 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 + m_SelectedEditorRenderState: 0 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 @@ -1393,33 +4432,76 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_MaskInteraction: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!23 &5059788001672154254 -MeshRenderer: + m_Sprite: {fileID: -2413806693520163455, guid: a86470a33a6bf42c4b3595704624658b, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_SpriteSortPoint: 0 + m_BlendShapeWeights: [] +--- !u!1 &1147351673 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1147351674} + - component: {fileID: 1147351675} + m_Layer: 0 + m_Name: broke car(h)art + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1147351674 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1147351673} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} + m_LocalPosition: {x: -0.009, y: -0.046, z: 0} + m_LocalScale: {x: 0.26821762, y: 0.8741474, z: 0.66059} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 314779088} + m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} +--- !u!212 &1147351675 +SpriteRenderer: + serializedVersion: 3 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 305272007978442846} + m_GameObject: {fileID: 1147351673} m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 m_DynamicOccludee: 1 m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 + m_RayTracingMode: 0 m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 m_ForceMeshLod: -1 m_MeshLodSelectionBias: 0 - m_RenderingLayerMask: 257 + m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 4396bb87f0803a84ca5ccbd7fb7d4844, type: 2} + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -1427,12 +4509,12 @@ MeshRenderer: m_ProbeAnchor: {fileID: 0} m_LightProbeVolumeOverride: {fileID: 0} m_ScaleInLightmap: 1 - m_ReceiveGI: 2 + m_ReceiveGI: 1 m_PreserveUVs: 0 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 + m_SelectedEditorRenderState: 0 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 @@ -1440,25 +4522,161 @@ MeshRenderer: m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 0 + m_SortingOrder: -1 + m_MaskInteraction: 0 + m_Sprite: {fileID: -1383480525566337821, guid: 704fd264765b4844abc193e0d7bdcb59, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 6.5, y: 1.99} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_SpriteSortPoint: 0 + m_BlendShapeWeights: [] +--- !u!1 &1152604148 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1152604149} + - component: {fileID: 1152604150} + m_Layer: 0 + m_Name: broke car(h)art + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &1152604149 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1152604148} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} + m_LocalPosition: {x: -0.007, y: -0.03, z: 0} + m_LocalScale: {x: 0.26546946, y: 0.8741474, z: 0.562499} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 314779088} + m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} +--- !u!212 &1152604150 +SpriteRenderer: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1152604148} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -1 m_MaskInteraction: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!4 &5270582871199435135 + m_Sprite: {fileID: 2480235408201113358, guid: 22e58921915437d4b999c51f4805ae72, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 6.5, y: 1.99} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_SpriteSortPoint: 0 + m_BlendShapeWeights: [] +--- !u!1 &1160234425 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1160234427} + - component: {fileID: 1160234426} + m_Layer: 0 + m_Name: Global Volume + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!114 &1160234426 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1160234425} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IsGlobal: 1 + priority: 0 + blendDistance: 0 + weight: 1 + sharedProfile: {fileID: 11400000, guid: 8844a2814356b584cb53afabd361c18a, type: 2} +--- !u!4 &1160234427 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8980234965581135787} + m_GameObject: {fileID: 1160234425} serializedVersion: 2 - m_LocalRotation: {x: -0.00000016292068, y: -0.000000043711395, z: 0.00000004371138, w: 1} - m_LocalPosition: {x: -0, y: 0, z: 0} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 1448501443085806459} + m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &5519764271386734523 +--- !u!1 &1256803062 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1466,25 +4684,78 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 8577614354117532858} - - component: {fileID: 3886155221346378004} - - component: {fileID: 8097064273423272568} + - component: {fileID: 1256803065} + - component: {fileID: 1256803064} + - component: {fileID: 1256803063} m_Layer: 0 - m_Name: Ball_Part + m_Name: EventSystem m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!33 &5691571643838763082 -MeshFilter: +--- !u!114 &1256803063 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1256803062} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.UI.InputSystemUIInputModule + m_SendPointerHoverToParent: 1 + m_MoveRepeatDelay: 0.5 + m_MoveRepeatRate: 0.1 + m_XRTrackingOrigin: {fileID: 0} + m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_DeselectOnBackgroundClick: 1 + m_PointerBehavior: 0 + m_CursorLockBehavior: 0 + m_ScrollDeltaPerTick: 6 +--- !u!114 &1256803064 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1256803062} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.EventSystems.EventSystem + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &1256803065 +Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8163965080769336533} - m_Mesh: {fileID: -6763925310212717797, guid: cff8f1f32dcb8f743b052f958d40ddc0, type: 3} ---- !u!1 &6093051471230134716 + m_GameObject: {fileID: 1256803062} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1462917631 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1492,145 +4763,127 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 750974001258836848} - - component: {fileID: 285757673750222148} - - component: {fileID: 7120302010817048496} + - component: {fileID: 1462917632} + - component: {fileID: 1462917634} + - component: {fileID: 1462917633} + - component: {fileID: 1462917635} + - component: {fileID: 1462917636} m_Layer: 0 - m_Name: Stand_Logo + m_Name: Wheel 1 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &6233777116457369307 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7845786399117771539} - serializedVersion: 2 - m_LocalRotation: {x: -0.000000011924881, y: -0.00000004371139, z: 0.00000004371139, w: 1} - m_LocalPosition: {x: -0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1448501443085806459} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &6381394025400310523 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8731691447768879912, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} - propertyPath: m_Name - value: SessionManager - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} ---- !u!33 &6476517947687084780 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2373536540347037660} - m_Mesh: {fileID: -3251575562234066762, guid: cff8f1f32dcb8f743b052f958d40ddc0, type: 3} ---- !u!4 &6754955248402670120 +--- !u!4 &1462917632 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8177051283744415050} + m_GameObject: {fileID: 1462917631} serializedVersion: 2 - m_LocalRotation: {x: -0.00000016292068, y: -0.000000043711395, z: 0.00000004371138, w: 1} - m_LocalPosition: {x: -0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.24732359, y: -0.88691753, z: 0} + m_LocalScale: {x: 0.23597327, y: 0.6796303, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 1448501443085806459} + m_Father: {fileID: 314779088} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &7105339341735408668 -MeshFilter: +--- !u!60 &1462917633 +PolygonCollider2D: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7845786399117771539} - m_Mesh: {fileID: 3521283738109391821, guid: cff8f1f32dcb8f743b052f958d40ddc0, type: 3} ---- !u!23 &7120302010817048496 -MeshRenderer: + m_GameObject: {fileID: 1462917631} + m_Enabled: 1 + serializedVersion: 3 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_CompositeOperation: 0 + m_CompositeOrder: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: 0, y: 0.5} + - {x: -0.15234375, y: 0.47265625} + - {x: -0.29296875, y: 0.40234375} + - {x: -0.40234375, y: 0.29296875} + - {x: -0.47265625, y: 0.15234375} + - {x: -0.5, y: 0} + - {x: -0.47265625, y: -0.15234375} + - {x: -0.40234375, y: -0.29296875} + - {x: -0.29296875, y: -0.40234375} + - {x: -0.15234375, y: -0.47265625} + - {x: 0, y: -0.5} + - {x: 0.15234375, y: -0.47265625} + - {x: 0.29296875, y: -0.40234375} + - {x: 0.40234375, y: -0.29296875} + - {x: 0.47265625, y: -0.15234375} + - {x: 0.5, y: 0} + - {x: 0.47265625, y: 0.15234375} + - {x: 0.40234375, y: 0.29296875} + - {x: 0.29296875, y: 0.40234375} + - {x: 0.15234375, y: 0.47265625} + m_UseDelaunayMesh: 1 +--- !u!212 &1462917634 +SpriteRenderer: + serializedVersion: 3 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6093051471230134716} + m_GameObject: {fileID: 1462917631} m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 m_DynamicOccludee: 1 m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 + m_RayTracingMode: 0 m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 m_ForceMeshLod: -1 m_MeshLodSelectionBias: 0 - m_RenderingLayerMask: 257 + m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: b0a1d05e58e6d8b42bec7a5d78210965, type: 2} + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -1638,12 +4891,12 @@ MeshRenderer: m_ProbeAnchor: {fileID: 0} m_LightProbeVolumeOverride: {fileID: 0} m_ScaleInLightmap: 1 - m_ReceiveGI: 2 + m_ReceiveGI: 1 m_PreserveUVs: 0 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 + m_SelectedEditorRenderState: 0 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 @@ -1653,88 +4906,125 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_MaskInteraction: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &7133170251085893050 -MeshFilter: + m_Sprite: {fileID: -2413806693520163455, guid: a86470a33a6bf42c4b3595704624658b, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_SpriteSortPoint: 0 + m_BlendShapeWeights: [] +--- !u!114 &1462917635 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1462917631} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0913a6f6f3b12c74584e8d20d982018f, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::WheelSpinner + rotationSpeed: -360 + maximumTorque: 20 + acceleration: 0.05 +--- !u!50 &1462917636 +Rigidbody2D: + serializedVersion: 5 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 708799364539981625} - m_Mesh: {fileID: 4262345794405271195, guid: cff8f1f32dcb8f743b052f958d40ddc0, type: 3} ---- !u!33 &7218820239248278125 -MeshFilter: + m_GameObject: {fileID: 1462917631} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDamping: 0 + m_AngularDamping: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!1001 &1662757146 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 121000000000002, guid: 201ea92e03ac4494bb5424c3e284c6fb, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 121000000000002, guid: 201ea92e03ac4494bb5424c3e284c6fb, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 121000000000002, guid: 201ea92e03ac4494bb5424c3e284c6fb, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 201ea92e03ac4494bb5424c3e284c6fb, type: 3} +--- !u!224 &1662757147 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 121000000000002, guid: 201ea92e03ac4494bb5424c3e284c6fb, type: 3} + m_PrefabInstance: {fileID: 1662757146} + m_PrefabAsset: {fileID: 0} +--- !u!1 &1787493462 +GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 305272007978442846} - m_Mesh: {fileID: -380643886415135931, guid: cff8f1f32dcb8f743b052f958d40ddc0, type: 3} ---- !u!4 &7404782291424719770 + serializedVersion: 6 + m_Component: + - component: {fileID: 1787493463} + m_Layer: 0 + m_Name: Car Scene 1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1787493463 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8163965080769336533} + m_GameObject: {fileID: 1787493462} serializedVersion: 2 - m_LocalRotation: {x: -0.00000028212997, y: -0.0000000437114, z: 0.000000043711378, w: 1} - m_LocalPosition: {x: -0, y: 0, z: -0.0000000027814178} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -174.7, y: -20.4, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 3874231289254137071} + m_Children: + - {fileID: 9302002} + - {fileID: 314779088} + - {fileID: 415455853} + - {fileID: 9301002} + m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!23 &7476877889312545141 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4094583408627704216} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_ForceMeshLod: -1 - m_MeshLodSelectionBias: 0 - m_RenderingLayerMask: 257 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: b0a1d05e58e6d8b42bec7a5d78210965, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 2 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_GlobalIlluminationMeshLod: 0 - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_MaskInteraction: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!1 &7482880494889535591 +--- !u!1 &1827265320 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1742,89 +5032,82 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 7823694312774259421} + - component: {fileID: 1827265321} + - component: {fileID: 1827265322} m_Layer: 0 - m_Name: UnityMaterialBall_Gold + m_Name: PlayerSpawner m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!23 &7499497021674395898 -MeshRenderer: +--- !u!4 &1827265321 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1827265320} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} + m_LocalPosition: {x: 0, y: 1, z: 7} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} +--- !u!114 &1827265322 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1528205290726672657} + m_GameObject: {fileID: 1827265320} m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_ForceMeshLod: -1 - m_MeshLodSelectionBias: 0 - m_RenderingLayerMask: 257 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: b0a1d05e58e6d8b42bec7a5d78210965, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 2 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_GlobalIlluminationMeshLod: 0 - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_MaskInteraction: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!33 &7667906935820937665 -MeshFilter: + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ced7bf28cdbee104e8cdc34ab761b039, type: 3} + m_Name: + m_EditorClassIdentifier: PurrNet.Runtime::PurrNet.PlayerSpawner + _playerPrefab: {fileID: 5154484800931780872, guid: 1f6329ff68c80dd46a8bb8e5db77130d, type: 3} + _ignoreNetworkRules: 0 + spawnPoints: + - {fileID: 1827265321} +--- !u!1 &1908478821 +GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8980234965581135787} - m_Mesh: {fileID: -6825379337611155391, guid: cff8f1f32dcb8f743b052f958d40ddc0, type: 3} ---- !u!4 &7823694312774259421 + serializedVersion: 6 + m_Component: + - component: {fileID: 1908478822} + m_Layer: 0 + m_Name: Car Scene 2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1908478822 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7482880494889535591} + m_GameObject: {fileID: 1908478821} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: -123.21912, y: -34.1338, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 1448501443085806459} - - {fileID: 3874231289254137071} - m_Father: {fileID: 505702790} + - {fileID: 9304002} + - {fileID: 2130553444} + - {fileID: 826997158} + - {fileID: 9303002} + m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &7845786399117771539 +--- !u!1 &2130553440 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1832,42 +5115,108 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 6233777116457369307} - - component: {fileID: 7105339341735408668} - - component: {fileID: 9102376964654609776} - m_Layer: 2 - m_Name: Back_Part_Logo + - component: {fileID: 2130553444} + - component: {fileID: 2130553443} + - component: {fileID: 2130553442} + - component: {fileID: 2130553441} + m_Layer: 0 + m_Name: Car (1) m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!23 &8097064273423272568 -MeshRenderer: +--- !u!114 &2130553441 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5519764271386734523} + m_GameObject: {fileID: 2130553440} m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b7024684365a4c7a92335f93ad10c86a, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::CarDrawingWheelInstaller + chassisMass: 4 + wheelRadius: 0.5 + wheelMass: 1 + wheelFriction: 0.9 + suspensionFrequency: 5 + suspensionDamping: 0.8 +--- !u!61 &2130553442 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2130553440} + m_Enabled: 1 + serializedVersion: 3 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_CompositeOperation: 0 + m_CompositeOrder: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 +--- !u!212 &2130553443 +SpriteRenderer: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2130553440} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 m_DynamicOccludee: 1 m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 + m_RayTracingMode: 0 m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 m_ForceMeshLod: -1 m_MeshLodSelectionBias: 0 - m_RenderingLayerMask: 257 + m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 4396bb87f0803a84ca5ccbd7fb7d4844, type: 2} + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -1875,12 +5224,12 @@ MeshRenderer: m_ProbeAnchor: {fileID: 0} m_LightProbeVolumeOverride: {fileID: 0} m_ScaleInLightmap: 1 - m_ReceiveGI: 2 + m_ReceiveGI: 1 m_PreserveUVs: 0 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 + m_SelectedEditorRenderState: 0 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 @@ -1890,8 +5239,35 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_MaskInteraction: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!1 &8163965080769336533 + m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_SpriteSortPoint: 0 + m_BlendShapeWeights: [] +--- !u!4 &2130553444 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2130553440} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 143.71912, y: -38.566196, z: 0} + m_LocalScale: {x: 4.237768, y: 1.4713882, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1060515555} + - {fileID: 601401179} + m_Father: {fileID: 1908478822} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &9000000001 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1899,17 +5275,107 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 7404782291424719770} - - component: {fileID: 5691571643838763082} - - component: {fileID: 8496002568620297863} + - component: {fileID: 9000000002} + - component: {fileID: 9000000003} m_Layer: 0 - m_Name: Stand_Part_2 + m_Name: Global Light 2D m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &8177051283744415050 +--- !u!4 &9000000002 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9000000001} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &9000000003 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9000000001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 073797afb82c5a1438f328866b10b3f0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ComponentVersion: 4 + m_LightType: 4 + m_BlendStyleIndex: 0 + m_Light2DProvider: + rid: -2 + m_SelectionSources: + rid: 5652862251393613915 + m_FalloffIntensity: 0.5 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: 1 + m_LightVolumeIntensity: 1 + m_LightVolumeEnabled: 0 + m_ApplyToSortingLayers: 00000000i + m_LightCookieSprite: {fileID: 0} + m_DeprecatedPointLightCookieSprite: {fileID: 0} + m_LightOrder: 0 + m_AlphaBlendOnOverlap: 0 + m_OverlapOperation: 0 + m_NormalMapDistance: 3 + m_NormalMapQuality: 2 + m_UseNormalMap: 0 + m_ShadowsEnabled: 0 + m_ShadowIntensity: 0.75 + m_ShadowSoftness: 0 + m_ShadowSoftnessFalloffIntensity: 0.5 + m_ShadowVolumeIntensityEnabled: 0 + m_ShadowVolumeIntensity: 0.75 + m_RenderingLayersMask: + serializedVersion: 0 + m_Bits: 1 + m_LocalBounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_PointLightInnerAngle: 360 + m_PointLightOuterAngle: 360 + m_PointLightInnerRadius: 0 + m_PointLightOuterRadius: 1 + m_ShapeLightParametricSides: 5 + m_ShapeLightParametricAngleOffset: 0 + m_ShapeLightParametricRadius: 1 + m_ShapeLightFalloffSize: 0.5 + m_ShapeLightFalloffOffset: {x: 0, y: 0} + m_ShapePath: + - {x: -0.5, y: -0.5, z: 0} + - {x: 0.5, y: -0.5, z: 0} + - {x: 0.5, y: 0.5, z: 0} + - {x: -0.5, y: 0.5, z: 0} + references: + version: 2 + RefIds: + - rid: -2 + type: {class: , ns: , asm: } + - rid: 5652862251393613915 + type: {class: Light2DProviderSources, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.2D.Runtime} + data: + m_SelectedHashCode: 4 + m_SelectedSource: + rid: -2 + m_Provider2DCache: + rid: 5652862251393613922 + - rid: 5652862251393613922 + type: {class: 'Provider2DCache`1[[UnityEngine.Rendering.Universal.Light2DProvider, Unity.RenderPipelines.Universal.2D.Runtime]]', ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.2D.Runtime} + data: + m_Cache: [] +--- !u!1 &9100000001 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1917,81 +5383,102 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 6754955248402670120} - - component: {fileID: 1507839029914702275} - - component: {fileID: 4711151955290684885} - m_Layer: 2 - m_Name: Front_Part + - component: {fileID: 9100000002} + - component: {fileID: 9100000003} + - component: {fileID: 9100000004} + - component: {fileID: 9100000005} + m_Layer: 5 + m_Name: UI m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!23 &8496002568620297863 -MeshRenderer: +--- !u!224 &9100000002 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9100000001} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 9305002} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!223 &9100000003 +Canvas: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8163965080769336533} + m_GameObject: {fileID: 9100000001} m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_ForceMeshLod: -1 - m_MeshLodSelectionBias: 0 - m_RenderingLayerMask: 257 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: b0a1d05e58e6d8b42bec7a5d78210965, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 2 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_GlobalIlluminationMeshLod: 0 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_UseReflectionProbes: 0 + m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 - m_SortingLayer: 0 m_SortingOrder: 0 - m_MaskInteraction: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!4 &8577614354117532858 -Transform: + m_TargetDisplay: 0 +--- !u!114 &9100000004 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5519764271386734523} - serializedVersion: 2 - m_LocalRotation: {x: -0.00000016292068, y: -0.000000043711395, z: 0.00000004371138, w: 1} - m_LocalPosition: {x: -0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1448501443085806459} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &8980234965581135787 + m_GameObject: {fileID: 9100000001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.CanvasScaler + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1280, y: 720} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0.5 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!114 &9100000005 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9100000001} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.GraphicRaycaster + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!1 &9700000001 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1999,81 +5486,123 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 5270582871199435135} - - component: {fileID: 7667906935820937665} - - component: {fileID: 3274465372524955329} - m_Layer: 2 - m_Name: Front_Part_Logo + - component: {fileID: 9700000002} + - component: {fileID: 9700000003} + m_Layer: 0 + m_Name: Network Wheel Paint Session m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 + m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!33 &8988423917994663629 -MeshFilter: +--- !u!4 &9700000002 +Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4094583408627704216} - m_Mesh: {fileID: 7751458673466434898, guid: cff8f1f32dcb8f743b052f958d40ddc0, type: 3} ---- !u!23 &9102376964654609776 -MeshRenderer: + m_GameObject: {fileID: 9700000001} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &9700000003 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7845786399117771539} + m_GameObject: {fileID: 9700000001} m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_ForceMeshLod: -1 - m_MeshLodSelectionBias: 0 - m_RenderingLayerMask: 257 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 4396bb87f0803a84ca5ccbd7fb7d4844, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 2 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_GlobalIlluminationMeshLod: 0 - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_MaskInteraction: 0 - m_AdditionalVertexStreams: {fileID: 0} + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d2f46c24ea514036bef670247fb72897, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::NetworkWheelPaintSession + defendant: 1 + paintEditorPrefab: {fileID: 121000000000006, guid: 201ea92e03ac4494bb5424c3e284c6fb, type: 3} + leftCar: {fileID: 314779091} + rightCar: {fileID: 2130553441} + regularPresentationObjects: + - {fileID: 961739749} + - {fileID: 9305001} + - {fileID: 9302001} + - {fileID: 9304001} + maximumDrawingBytes: 2097152 + maximumDrawingDimension: 2048 +--- !u!1001 &6381394025400310523 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2456116641176859992, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8731691447768879912, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} + propertyPath: m_Name + value: SessionManager + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 49f5e0e1e386aae4c899230538530f63, type: 3} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 m_Roots: - {fileID: 961739753} - {fileID: 1160234427} - - {fileID: 604712594} - - {fileID: 505702790} - {fileID: 6381394025400310523} - {fileID: 1256803065} - {fileID: 1827265321} + - {fileID: 9000000002} + - {fileID: 9100000002} + - {fileID: 1787493463} + - {fileID: 1908478822} + - {fileID: 459768754} + - {fileID: 1662757147} + - {fileID: 9700000002} diff --git a/Assets/Scenes/MainGame/LightingData.asset b/Assets/Scenes/MainGame/LightingData.asset index a4070c60..07e50bbc 100644 Binary files a/Assets/Scenes/MainGame/LightingData.asset and b/Assets/Scenes/MainGame/LightingData.asset differ diff --git a/Assets/Scenes/MainGame/ReflectionProbe-0.exr b/Assets/Scenes/MainGame/ReflectionProbe-0.exr index 350ce8dd..ca5d0c18 100644 Binary files a/Assets/Scenes/MainGame/ReflectionProbe-0.exr and b/Assets/Scenes/MainGame/ReflectionProbe-0.exr differ diff --git a/Assets/Scenes/MainGame/ReflectionProbe-0.exr.meta b/Assets/Scenes/MainGame/ReflectionProbe-0.exr.meta index f0eb9cd4..99a6f0ce 100644 --- a/Assets/Scenes/MainGame/ReflectionProbe-0.exr.meta +++ b/Assets/Scenes/MainGame/ReflectionProbe-0.exr.meta @@ -53,7 +53,9 @@ TextureImporter: spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 alphaIsTransparency: 0 + spriteTessellationMethod: 0 spriteTessellationDetail: -1 + spriteGeometrySubdivision: -1 textureType: 0 textureShape: 2 singleChannelComponent: 0 @@ -93,6 +95,32 @@ TextureImporter: ignorePlatformSupport: 0 androidETC2FallbackOverride: 0 forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: iOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: [] diff --git a/Assets/Scenes/MainGame/ReflectionProbe-1.exr b/Assets/Scenes/MainGame/ReflectionProbe-1.exr new file mode 100644 index 00000000..9318d884 Binary files /dev/null and b/Assets/Scenes/MainGame/ReflectionProbe-1.exr differ diff --git a/Assets/Scenes/MainGame/ReflectionProbe-1.exr.meta b/Assets/Scenes/MainGame/ReflectionProbe-1.exr.meta new file mode 100644 index 00000000..885be48b --- /dev/null +++ b/Assets/Scenes/MainGame/ReflectionProbe-1.exr.meta @@ -0,0 +1,145 @@ +fileFormatVersion: 2 +guid: 98e72326279831b4488ff55bcc70780d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 1 + seamlessCubemap: 1 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 0 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + 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 + spriteTessellationMethod: 0 + spriteTessellationDetail: -1 + spriteGeometrySubdivision: -1 + textureType: 0 + textureShape: 2 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 100 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: iOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MainMenu.meta b/Assets/Scenes/MainMenu.meta new file mode 100644 index 00000000..d4fbd83b --- /dev/null +++ b/Assets/Scenes/MainMenu.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 29358467cb9b19644afa9e6e55a0fe45 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MainMenu.unity b/Assets/Scenes/MainMenu.unity index ac94f573..90f1f704 100644 --- a/Assets/Scenes/MainMenu.unity +++ b/Assets/Scenes/MainMenu.unity @@ -93,7 +93,7 @@ LightmapSettings: m_ExportTrainingData: 0 m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 - m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0} + m_LightingDataAsset: {fileID: 112000000, guid: 388c179f76d41c04f9b9080357f784b9, type: 2} m_LightingSettings: {fileID: 0} --- !u!196 &4 NavMeshSettings: diff --git a/Assets/Scenes/MainMenu/LightingData.asset b/Assets/Scenes/MainMenu/LightingData.asset new file mode 100644 index 00000000..ac31bac7 Binary files /dev/null and b/Assets/Scenes/MainMenu/LightingData.asset differ diff --git a/Assets/Scenes/MainMenu/LightingData.asset.meta b/Assets/Scenes/MainMenu/LightingData.asset.meta new file mode 100644 index 00000000..9cd495a0 --- /dev/null +++ b/Assets/Scenes/MainMenu/LightingData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 388c179f76d41c04f9b9080357f784b9 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 112000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MainMenu/ReflectionProbe-0.exr b/Assets/Scenes/MainMenu/ReflectionProbe-0.exr new file mode 100644 index 00000000..9318d884 Binary files /dev/null and b/Assets/Scenes/MainMenu/ReflectionProbe-0.exr differ diff --git a/Assets/Scenes/MainMenu/ReflectionProbe-0.exr.meta b/Assets/Scenes/MainMenu/ReflectionProbe-0.exr.meta new file mode 100644 index 00000000..9126eab1 --- /dev/null +++ b/Assets/Scenes/MainMenu/ReflectionProbe-0.exr.meta @@ -0,0 +1,145 @@ +fileFormatVersion: 2 +guid: 53f9bcd8891ff5f42aaecfcf8d667e73 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 1 + seamlessCubemap: 1 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 0 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + 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 + spriteTessellationMethod: 0 + spriteTessellationDetail: -1 + spriteGeometrySubdivision: -1 + textureType: 0 + textureShape: 2 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 100 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: iOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/evidenceSelection.unity b/Assets/Scenes/evidenceSelection.unity new file mode 100644 index 00000000..e90e23f3 --- /dev/null +++ b/Assets/Scenes/evidenceSelection.unity @@ -0,0 +1,1072 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 10 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 2 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 2 + m_PVRDenoiserTypeIndirect: 2 + m_PVRDenoiserTypeAO: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 1 + m_PVRFilteringGaussRadiusAO: 1 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &47968240 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 47968243} + - component: {fileID: 47968242} + - component: {fileID: 47968241} + m_Layer: 5 + m_Name: SelectionCountText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &47968241 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 47968240} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 0 / 3 selected + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 15 + m_fontSizeBase: 15 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_characterHorizontalScale: 1 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656bu + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &47968242 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 47968240} + m_CullTransparentMesh: 1 +--- !u!224 &47968243 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 47968240} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 138669057} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 624, y: -353} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &102637480 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 102637483} + - component: {fileID: 102637482} + - component: {fileID: 102637481} + - component: {fileID: 102637484} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &102637481 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 102637480} + m_Enabled: 1 +--- !u!20 &102637482 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 102637480} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 4 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &102637483 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 102637480} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &102637484 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 102637480} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.UniversalAdditionalCameraData + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 0 + m_Cameras: [] + m_RendererIndex: -1 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_VolumeFrameworkUpdateModeOption: 2 + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_ClearDepth: 1 + m_AllowXRRendering: 1 + m_AllowHDROutput: 1 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_TaaSettings: + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 + m_Version: 2 +--- !u!1 &138669053 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 138669057} + - component: {fileID: 138669056} + - component: {fileID: 138669055} + - component: {fileID: 138669054} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &138669054 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 138669053} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.GraphicRaycaster + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &138669055 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 138669053} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.CanvasScaler + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1280, y: 720} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &138669056 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 138669053} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_UseReflectionProbes: 0 + m_AdditionalShaderChannelsFlag: 25 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &138669057 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 138669053} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1778604734} + - {fileID: 668510475} + - {fileID: 1287392483} + - {fileID: 47968243} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &389754670 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 389754673} + - component: {fileID: 389754672} + - component: {fileID: 389754671} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &389754671 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 389754670} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.UI.InputSystemUIInputModule + m_SendPointerHoverToParent: 1 + m_MoveRepeatDelay: 0.5 + m_MoveRepeatRate: 0.1 + m_XRTrackingOrigin: {fileID: 0} + m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_DeselectOnBackgroundClick: 1 + m_PointerBehavior: 0 + m_CursorLockBehavior: 0 + m_ScrollDeltaPerTick: 6 +--- !u!114 &389754672 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 389754670} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.EventSystems.EventSystem + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &389754673 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 389754670} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &668510474 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 668510475} + - component: {fileID: 668510477} + - component: {fileID: 668510476} + m_Layer: 5 + m_Name: evidenceSelectionText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &668510475 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668510474} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 138669057} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -256, y: 324} + m_AnchoredPosition: {x: -256, y: 199} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &668510476 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668510474} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Evidence Selection + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: 97690656 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 51.4 + m_fontSizeBase: 51.4 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_characterHorizontalScale: 1 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656bu + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: -536.6646, w: -95.33862} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &668510477 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668510474} + m_CullTransparentMesh: 1 +--- !u!1 &1225323648 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1225323650} + - component: {fileID: 1225323649} + m_Layer: 0 + m_Name: EvidenceSelectionManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1225323649 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1225323648} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9d269e46dc39cbb40a9a832153edfe5f, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::EvidenceSelectionUI + caseData: {fileID: 11400000, guid: 7efc165dd1a540e4e87045b585daa205, type: 2} + evidenceContainer: {fileID: 1287392483} + evidenceCardPrefab: {fileID: 626862531384200315, guid: 3ed632a08b340e24593cd554b7c63bd1, type: 3} + stickyNoteSprites: + - {fileID: 4502059151166531557, guid: d0b812af2547bd345b45c5bd3eb0eabe, type: 3} + - {fileID: -2654900912091873650, guid: a5c3e97dee48c35438ab28c6b0752556, type: 3} + - {fileID: -2634547011037757618, guid: d63991ca90bcef74ea10b013788f08f3, type: 3} + - {fileID: 323230245057533145, guid: 302792815ae704547909174ed0540238, type: 3} + stickyNoteScaleRange: {x: 0.86, y: 1.08} + maxSelections: 3 + selectionCountText: {fileID: 47968241} + selectedEvidence: [] +--- !u!4 &1225323650 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1225323648} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 37, y: 387, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1287392482 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1287392483} + - component: {fileID: 1287392484} + m_Layer: 0 + m_Name: EvidenceGrid + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1287392483 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1287392482} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 138669057} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0.1344, y: -34.6888} + m_SizeDelta: {x: 1233.2527, y: 607.3774} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1287392484 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1287392482} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8a8695521f0d02e499659fee002a26c2, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.GridLayoutGroup + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 4 + m_StartCorner: 0 + m_StartAxis: 0 + m_CellSize: {x: 280, y: 280} + m_Spacing: {x: 29.7509, y: 23.37738} + m_Constraint: 1 + m_ConstraintCount: 4 +--- !u!1 &1778604733 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1778604734} + - component: {fileID: 1778604736} + - component: {fileID: 1778604735} + m_Layer: 5 + m_Name: gameName + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1778604734 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778604733} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 138669057} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 19, y: 244} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1778604735 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778604733} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Motions in motion + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 22.3 + m_fontSizeBase: 22.3 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_characterHorizontalScale: 1 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656bu + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: -3.0756836, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &1778604736 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778604733} + m_CullTransparentMesh: 1 +--- !u!1 &1838602039 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1838602041} + - component: {fileID: 1838602040} + m_Layer: 0 + m_Name: BG + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &1838602040 +SpriteRenderer: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1838602039} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_MaskInteraction: 0 + m_Sprite: {fileID: 3954734884487546598, guid: a9fcfadc574a443488f89dca5b5b2819, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 20.48, y: 20.48} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_SpriteSortPoint: 0 + m_BlendShapeWeights: [] +--- !u!4 &1838602041 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1838602039} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.04, y: -4.1, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 102637483} + - {fileID: 138669057} + - {fileID: 389754673} + - {fileID: 1225323650} + - {fileID: 1838602041} diff --git a/Assets/Scenes/evidenceSelection.unity.meta b/Assets/Scenes/evidenceSelection.unity.meta new file mode 100644 index 00000000..ae8338fb --- /dev/null +++ b/Assets/Scenes/evidenceSelection.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0171f5f0ae130d14e90b2f35de3d6796 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts.meta b/Assets/Scripts.meta new file mode 100644 index 00000000..db26f400 --- /dev/null +++ b/Assets/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 62c89c6fc23241de88fa8956fb6244a3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/CarDrawingWheelInstaller.cs b/Assets/Scripts/CarDrawingWheelInstaller.cs new file mode 100644 index 00000000..fe8338ab --- /dev/null +++ b/Assets/Scripts/CarDrawingWheelInstaller.cs @@ -0,0 +1,288 @@ +using System.Collections.Generic; +using UnityEngine; + +/// +/// Turns world drawings made by PaintEditorCanvas into the two physical wheels of this car. +/// Each drawing is duplicated so both wheels always use the same shape. +/// +[DisallowMultipleComponent] +public sealed class CarDrawingWheelInstaller : MonoBehaviour +{ + [SerializeField, Min(0.1f)] private float chassisMass = 4f; + [SerializeField, Min(0.05f)] private float wheelRadius = 0.5f; + [SerializeField, Min(0.01f)] private float wheelMass = 1f; + [SerializeField, Range(0f, 1f)] private float wheelFriction = 0.9f; + [SerializeField, Min(0f)] private float suspensionFrequency = 5f; + [SerializeField, Range(0f, 1f)] private float suspensionDamping = 0.8f; + + private static CarDrawingWheelInstaller activeInstaller; + + private readonly List wheelMounts = new(); + private readonly List installedWheels = new(); + private Rigidbody2D chassisBody; + private PhysicsMaterial2D wheelMaterial; + private float preservedRotationSpeed = -360f; + private Texture2D installedDrawingTexture; + private Sprite installedDrawingSprite; + + private void Awake() + { + activeInstaller = this; + chassisBody = GetComponent(); + if (chassisBody == null) + chassisBody = gameObject.AddComponent(); + + chassisBody.interpolation = RigidbodyInterpolation2D.Interpolate; + chassisBody.collisionDetectionMode = CollisionDetectionMode2D.Continuous; + chassisBody.mass = chassisMass; + + wheelMaterial = new PhysicsMaterial2D("Drawn Wheel Grip") + { + friction = wheelFriction, + bounciness = 0f + }; + + var originalWheels = GetComponentsInChildren(true); + System.Array.Sort(originalWheels, + (a, b) => a.transform.position.x.CompareTo(b.transform.position.x)); + + if (originalWheels.Length > 0) + preservedRotationSpeed = originalWheels[0].RotationSpeed; + + foreach (var wheel in originalWheels) + { + wheelMounts.Add(transform.InverseTransformPoint(wheel.transform.position)); + PrepareWheel(wheel.gameObject, false); + installedWheels.Add(wheel.gameObject); + } + + if (wheelMounts.Count == 0) + { + wheelMounts.Add(new Vector3(-0.25f, -0.9f, 0f)); + wheelMounts.Add(new Vector3(0.25f, -0.9f, 0f)); + } + } + + private void OnDestroy() + { + if (activeInstaller == this) + activeInstaller = null; + + if (wheelMaterial != null) + Destroy(wheelMaterial); + if (installedDrawingSprite != null) + Destroy(installedDrawingSprite); + if (installedDrawingTexture != null) + Destroy(installedDrawingTexture); + } + + /// + /// Entry point used by PaintEditorCanvas immediately after it creates a drawing GameObject. + /// + public static bool TryInstallDrawing(GameObject drawing) + { + if (activeInstaller == null || drawing == null) + return false; + + activeInstaller.InstallDrawingAsWheels(drawing); + return true; + } + + /// Selects this car for the next call to TryInstallDrawing. + public void SelectForNextDrawing() + { + activeInstaller = this; + } + + public void InstallDrawingAsWheels(GameObject drawing) + { + if (drawing == null || wheelMounts.Count == 0) + return; + + var drawingRenderer = drawing.GetComponent(); + var nextSprite = drawingRenderer != null ? drawingRenderer.sprite : null; + var nextTexture = nextSprite != null ? nextSprite.texture : null; + var previousSprite = installedDrawingSprite; + var previousTexture = installedDrawingTexture; + + drawing.transform.SetParent(null, true); + drawing.transform.rotation = transform.rotation; + FitDrawingToWheelRadius(drawing); + + var replacementWheels = new List { drawing }; + for (var slot = 1; slot < wheelMounts.Count; slot++) + replacementWheels.Add(Instantiate(drawing)); + + foreach (var oldWheel in installedWheels) + { + if (oldWheel == null) + continue; + + oldWheel.SetActive(false); + Destroy(oldWheel); + } + installedWheels.Clear(); + + for (var slot = 0; slot < replacementWheels.Count; slot++) + { + var wheel = replacementWheels[slot]; + wheel.name = slot == 0 ? "Drawn Wheel Left" : "Drawn Wheel Right"; + wheel.transform.position = transform.TransformPoint(wheelMounts[slot]); + wheel.transform.rotation = transform.rotation; + PrepareWheel(wheel, true); + installedWheels.Add(wheel); + } + + installedDrawingSprite = nextSprite; + installedDrawingTexture = nextTexture; + if (previousSprite != null && previousSprite != installedDrawingSprite) + Destroy(previousSprite); + if (previousTexture != null && previousTexture != installedDrawingTexture) + Destroy(previousTexture); + } + + public bool InstallPngAsWheels(byte[] pngData, int maximumDimension = 2048) + { + if (!TryReadPngSize(pngData, out var width, out var height) || + width > maximumDimension || height > maximumDimension) + return false; + + var texture = new Texture2D(2, 2, TextureFormat.RGBA32, false) + { + name = "Network Wheel Drawing Texture", + filterMode = FilterMode.Bilinear, + wrapMode = TextureWrapMode.Clamp + }; + + if (!texture.LoadImage(pngData, false) || texture.width != width || texture.height != height) + { + Destroy(texture); + return false; + } + + var sprite = Sprite.Create( + texture, + new Rect(0f, 0f, texture.width, texture.height), + new Vector2(0.5f, 0.5f), + 100f, + 0, + SpriteMeshType.Tight, + Vector4.zero, + true); + sprite.name = "Network Wheel Drawing Sprite"; + + var drawing = new GameObject("Network Wheel Drawing"); + var spriteRenderer = drawing.AddComponent(); + spriteRenderer.sprite = sprite; + spriteRenderer.sortingOrder = 10; + + var polygonCollider = drawing.AddComponent(); + CopySpritePhysicsShape(sprite, polygonCollider); + drawing.AddComponent(); + InstallDrawingAsWheels(drawing); + return true; + } + + public static bool TryReadPngSize(byte[] pngData, out int width, out int height) + { + width = 0; + height = 0; + if (pngData == null || pngData.Length < 24) + return false; + + if (pngData[0] != 137 || pngData[1] != 80 || pngData[2] != 78 || pngData[3] != 71 || + pngData[4] != 13 || pngData[5] != 10 || pngData[6] != 26 || pngData[7] != 10 || + pngData[12] != 73 || pngData[13] != 72 || pngData[14] != 68 || pngData[15] != 82) + return false; + + width = ReadBigEndianInt(pngData, 16); + height = ReadBigEndianInt(pngData, 20); + return width > 0 && height > 0; + } + + private static int ReadBigEndianInt(byte[] data, int offset) + { + return (data[offset] << 24) | + (data[offset + 1] << 16) | + (data[offset + 2] << 8) | + data[offset + 3]; + } + + private static void CopySpritePhysicsShape(Sprite sprite, PolygonCollider2D polygonCollider) + { + var shapeCount = sprite.GetPhysicsShapeCount(); + if (shapeCount == 0) + { + polygonCollider.enabled = false; + Debug.LogWarning("Unity could not generate a polygon outline for this drawing.", polygonCollider); + return; + } + + polygonCollider.pathCount = shapeCount; + var points = new List(); + for (var pathIndex = 0; pathIndex < shapeCount; pathIndex++) + { + points.Clear(); + sprite.GetPhysicsShape(pathIndex, points); + polygonCollider.SetPath(pathIndex, points); + } + } + + private void FitDrawingToWheelRadius(GameObject drawing) + { + var renderer = drawing.GetComponent(); + if (renderer == null) + return; + + var largestDimension = Mathf.Max(renderer.bounds.size.x, renderer.bounds.size.y); + if (largestDimension <= Mathf.Epsilon) + return; + + var scale = wheelRadius * 2f / largestDimension; + drawing.transform.localScale *= scale; + } + + private void PrepareWheel(GameObject wheel, bool addSpinner) + { + // Wheels must be independent bodies. Parenting them to the scaled chassis would + // distort both their drawing and their collider. + wheel.transform.SetParent(null, true); + + var body = wheel.GetComponent(); + if (body == null) + body = wheel.AddComponent(); + + body.bodyType = RigidbodyType2D.Dynamic; + body.mass = wheelMass; + body.gravityScale = 1f; + body.interpolation = RigidbodyInterpolation2D.Interpolate; + body.collisionDetectionMode = CollisionDetectionMode2D.Continuous; + + foreach (var wheelCollider in wheel.GetComponents()) + wheelCollider.sharedMaterial = wheelMaterial; + + var joint = wheel.GetComponent(); + if (joint == null) + joint = wheel.AddComponent(); + + joint.connectedBody = chassisBody; + joint.autoConfigureConnectedAnchor = false; + joint.anchor = Vector2.zero; + joint.connectedAnchor = transform.InverseTransformPoint(wheel.transform.position); + joint.enableCollision = false; + + var suspension = joint.suspension; + suspension.frequency = suspensionFrequency; + suspension.dampingRatio = suspensionDamping; + suspension.angle = 90f; + joint.suspension = suspension; + + if (addSpinner) + { + var spinner = wheel.GetComponent(); + if (spinner == null) + spinner = wheel.AddComponent(); + spinner.SetRotationSpeed(preservedRotationSpeed); + } + } +} diff --git a/Assets/Scripts/CarDrawingWheelInstaller.cs.meta b/Assets/Scripts/CarDrawingWheelInstaller.cs.meta new file mode 100644 index 00000000..3cf951af --- /dev/null +++ b/Assets/Scripts/CarDrawingWheelInstaller.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b7024684365a4c7a92335f93ad10c86a diff --git a/Assets/Scripts/Data.meta b/Assets/Scripts/Data.meta new file mode 100644 index 00000000..2ee774e3 --- /dev/null +++ b/Assets/Scripts/Data.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6c0e75a420c95614e934389e4cdac553 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Data/CaseData.cs b/Assets/Scripts/Data/CaseData.cs new file mode 100644 index 00000000..be7c6693 --- /dev/null +++ b/Assets/Scripts/Data/CaseData.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +[CreateAssetMenu(fileName = "NewCase", menuName = "Court Game/Case")] +public class CaseData : ScriptableObject +{ + public string caseName; + + [TextArea(3, 10)] + public string caseDescription; + + public string caseAnswer; + + public List evidence; +} + +[Serializable] +public class EvidenceData +{ + public string evidenceName; + + [TextArea(2, 8)] + public string description; + + public Sprite image; +} \ No newline at end of file diff --git a/Assets/Scripts/Data/CaseData.cs.meta b/Assets/Scripts/Data/CaseData.cs.meta new file mode 100644 index 00000000..ff9dda93 --- /dev/null +++ b/Assets/Scripts/Data/CaseData.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5e6971ff3d637f14aabae16a22ce31d3 \ No newline at end of file diff --git a/Assets/Scripts/Game.meta b/Assets/Scripts/Game.meta new file mode 100644 index 00000000..3858f9d6 --- /dev/null +++ b/Assets/Scripts/Game.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f016d77717cc0af4ea5972190c127ea5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Game/GameSession.cs b/Assets/Scripts/Game/GameSession.cs new file mode 100644 index 00000000..c3a3c1e8 --- /dev/null +++ b/Assets/Scripts/Game/GameSession.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +public class GameSession : MonoBehaviour +{ + public static GameSession Instance; + + [Header("Current Game")] + public CaseData selectedCase; + + private void Awake() + { + if (Instance != null && Instance != this) + { + Destroy(gameObject); + return; + } + + Instance = this; + + DontDestroyOnLoad(gameObject); + } + + public void SetCase(CaseData newCase) + { + selectedCase = newCase; + + Debug.Log( + $"Selected case: {selectedCase.caseName}" + ); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Game/GameSession.cs.meta b/Assets/Scripts/Game/GameSession.cs.meta new file mode 100644 index 00000000..34d0d82d --- /dev/null +++ b/Assets/Scripts/Game/GameSession.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: d4b7cd712a096aa42844840927522c63 \ No newline at end of file diff --git a/Assets/Scripts/JamPurrTransportGameAllocator.cs b/Assets/Scripts/JamPurrTransportGameAllocator.cs new file mode 100644 index 00000000..24496541 --- /dev/null +++ b/Assets/Scripts/JamPurrTransportGameAllocator.cs @@ -0,0 +1,43 @@ +using System; +using System.Threading.Tasks; +using PurrNet; +using PurrNet.Lobby; +using PurrNet.Transports; +using UnityEngine; + +/// +/// MainMenu game allocator. Each start gets a fresh PurrTransport room so a +/// previous match cannot prevent the new authoritative host from listening. +/// +[CreateAssetMenu(menuName = "Game Jam/PurrTransport Game Allocator")] +public sealed class JamPurrTransportGameAllocator : GameAllocatorProvider +{ + [SerializeField, PurrScene] private string gameScene; + [SerializeField] private bool useP2P = true; + + public override Task AllocateGame(ILobby lobby) + { + return Task.FromResult(GameStartResponse.Success(new ConnectionInfo + { + // LobbyView distributes this one response to every member. Generating + // it once here keeps everyone together while avoiding stale-room reuse. + serverAddress = "PURRLOBBY_GAME_" + lobby.id + "_" + Guid.NewGuid().ToString("N"), + hostId = lobby.owner?.id + })); + } + + public override Task LoadGame(ILobby lobby) + { + return LoadGameScene(gameScene); + } + + protected override bool ConfigureTransport(NetworkManager manager, ConnectionInfo connection, bool asHost) + { + var transport = manager.transport as PurrTransport + ?? GetOrAddComponent(manager.gameObject); + manager.transport = transport; + transport.roomName = connection.serverAddress; + transport.useNat = useP2P; + return true; + } +} diff --git a/Assets/Scripts/JamPurrTransportGameAllocator.cs.meta b/Assets/Scripts/JamPurrTransportGameAllocator.cs.meta new file mode 100644 index 00000000..15e8efa2 --- /dev/null +++ b/Assets/Scripts/JamPurrTransportGameAllocator.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 763a0a75464d4e21a386a5ad94ef5db8 diff --git a/Assets/Scripts/NetworkWheelPaintSession.cs b/Assets/Scripts/NetworkWheelPaintSession.cs new file mode 100644 index 00000000..5e1e0eba --- /dev/null +++ b/Assets/Scripts/NetworkWheelPaintSession.cs @@ -0,0 +1,319 @@ +using System.Collections; +using System.Collections.Generic; +using PurrNet; +using UnityEngine; + +[DefaultExecutionOrder(-1000)] +[DisallowMultipleComponent] +public sealed class NetworkWheelPaintSession : MonoBehaviour +{ + [Header("Team")] + [SerializeField] private bool defendant = true; + + [Header("Scene references")] + [SerializeField] private PaintEditorCanvas paintEditorPrefab; + [SerializeField] private CarDrawingWheelInstaller leftCar; + [SerializeField] private CarDrawingWheelInstaller rightCar; + [SerializeField] private GameObject[] regularPresentationObjects; + + [Header("Upload limits")] + [SerializeField, Min(1024)] private int maximumDrawingBytes = 2 * 1024 * 1024; + [SerializeField, Min(128)] private int maximumDrawingDimension = 2048; + + private readonly Dictionary lastAcceptedSubmission = new(); + private NetworkManager manager; + private Networking networking; + private PaintEditorCanvas localEditor; + private uint nextSubmissionId; + private uint pendingSubmissionId; + private byte[] pendingDrawing; + private float nextSubmissionRetryTime; + private bool pendingFailureLogged; + private bool presentationConfigured; + private bool editorPresentationVisible; + private bool instantiatedLocalEditor; + private Transform localEditorOriginalParent; + private GameObject editorBackgroundCamera; + + private IEnumerator Start() + { + while (NetworkManager.main == null || Networking.instance == null) + yield return null; + + manager = NetworkManager.main; + networking = Networking.instance; + networking.drawingReceivedOnHost += OnDrawingReceivedOnHost; + networking.drawingReceiptReceived += OnDrawingReceiptReceived; + manager.RegisterEvents(OnNetworkStarted, OnNetworkStopped); + } + + private void OnDestroy() + { + if (localEditor != null) + localEditor.DrawingSubmitted -= SubmitLocalDrawing; + + if (networking != null) + { + networking.drawingReceivedOnHost -= OnDrawingReceivedOnHost; + networking.drawingReceiptReceived -= OnDrawingReceiptReceived; + } + + if (manager != null) + manager.UnregisterEvents(OnNetworkStarted, OnNetworkStopped); + } + + private void OnNetworkStarted(NetworkManager activeManager, bool asServer) + { + manager = activeManager; + if (asServer) + { + lastAcceptedSubmission.Clear(); + return; + } + + ConfigureLocalPresentation(); + } + + private void OnNetworkStopped(NetworkManager stoppedManager, bool asServer) + { + if (asServer) + lastAcceptedSubmission.Clear(); + else + { + pendingDrawing = null; + RestoreRegularPresentation(); + } + } + + private void LateUpdate() + { + if (manager == null || !manager.isClient) + return; + + bool shouldShowEditor = !manager.isServer; + if (!presentationConfigured || editorPresentationVisible != shouldShowEditor) + ConfigureLocalPresentation(); + + if (pendingDrawing != null && !manager.isServer && Time.unscaledTime >= nextSubmissionRetryTime) + SendPendingDrawing(); + } + + private void ConfigureLocalPresentation() + { + if (manager == null || !manager.isClient) + return; + + // PurrLobby loads MainGame first and starts this process as either a host + // (server + client) or a joining client. The actual server state is the + // authoritative distinction; lobby startup flags are not. + bool showEditor = !manager.isServer; + presentationConfigured = true; + editorPresentationVisible = showEditor; + SetRegularPresentationVisible(!showEditor); + + if (!showEditor) + { + HideLocalEditor(); + return; + } + + localEditor = FindAnyObjectByType(FindObjectsInactive.Include); + if (localEditor == null && paintEditorPrefab != null) + { + localEditor = Instantiate(paintEditorPrefab); + instantiatedLocalEditor = true; + } + + if (localEditor == null) + { + Debug.LogError("Network wheel painting needs a PaintEditorCanvas in the scene or a prefab reference.", this); + return; + } + + if (localEditorOriginalParent == null && localEditor.transform.parent != null) + localEditorOriginalParent = localEditor.transform.parent; + if (localEditor.transform.parent != null) + localEditor.transform.SetParent(null, false); + + var editorRect = (RectTransform)localEditor.transform; + editorRect.anchorMin = Vector2.zero; + editorRect.anchorMax = Vector2.one; + editorRect.anchoredPosition = Vector2.zero; + editorRect.sizeDelta = Vector2.zero; + editorRect.pivot = new Vector2(0.5f, 0.5f); + localEditor.transform.localScale = Vector3.one; + localEditor.name = defendant ? "Defendant Wheel Paint Editor" : "Other Team Wheel Paint Editor"; + localEditor.DrawingSubmitted -= SubmitLocalDrawing; + localEditor.DrawingSubmitted += SubmitLocalDrawing; + localEditor.SetToggleButtonVisible(false); + localEditor.SetPermanentOpen(true); + EnsureEditorBackgroundCamera(); + } + + private bool SubmitLocalDrawing(byte[] pngData) + { + if (manager == null || !manager.isClient || !IsValidDrawing(pngData)) + return false; + + uint submissionId = ++nextSubmissionId; + if (submissionId == 0) + submissionId = ++nextSubmissionId; + + if (manager.isServer) + { + OnDrawingReceivedOnHost(manager.localPlayer, new WheelDrawingUpload + { + submissionId = submissionId, + defendant = defendant, + pngData = pngData + }); + } + else + { + pendingSubmissionId = submissionId; + pendingDrawing = pngData; + pendingFailureLogged = false; + SendPendingDrawing(); + } + + return true; + } + + private void SendPendingDrawing() + { + if (manager == null || !manager.isClient || manager.isServer || pendingDrawing == null) + return; + + if (networking != null && networking.SendDrawingToHost(pendingSubmissionId, defendant, pendingDrawing)) + nextSubmissionRetryTime = Time.unscaledTime + 2f; + else + nextSubmissionRetryTime = Time.unscaledTime + 0.5f; + } + + private void OnDrawingReceivedOnHost(PlayerID sender, WheelDrawingUpload upload) + { + if (manager == null || !manager.isServer || upload == null) + return; + + if (lastAcceptedSubmission.TryGetValue(sender, out uint acceptedId) && upload.submissionId <= acceptedId) + { + networking.SendDrawingReceipt(sender, upload.submissionId, true); + return; + } + + if (!IsValidDrawing(upload.pngData)) + { + networking.SendDrawingReceipt(sender, upload.submissionId, false); + return; + } + + var targetCar = upload.defendant ? leftCar : rightCar; + bool installed = targetCar != null && + targetCar.InstallPngAsWheels(upload.pngData, maximumDrawingDimension); + + if (installed) + { + lastAcceptedSubmission[sender] = upload.submissionId; + Debug.Log($"Installed wheel drawing {upload.submissionId} from player {sender} on the host car.", this); + } + else + { + Debug.LogError("The host received a complete wheel drawing but could not install it on the target car.", this); + } + + networking.SendDrawingReceipt(sender, upload.submissionId, installed); + } + + private void OnDrawingReceiptReceived(WheelDrawingReceipt receipt) + { + if (receipt == null || receipt.submissionId != pendingSubmissionId) + return; + + if (receipt.accepted) + { + pendingDrawing = null; + pendingFailureLogged = false; + return; + } + + // A valid drawing can arrive before every host scene object has completed + // initialization. Keep it pending and retry instead of losing the submission. + if (!pendingFailureLogged) + { + Debug.LogWarning("The host received the wheel drawing but was not ready to install it; retrying.", this); + pendingFailureLogged = true; + } + nextSubmissionRetryTime = Time.unscaledTime + 2f; + } + + private bool IsValidDrawing(byte[] pngData) + { + if (pngData == null || pngData.Length == 0 || pngData.Length > maximumDrawingBytes) + return false; + + return CarDrawingWheelInstaller.TryReadPngSize(pngData, out int width, out int height) && + width <= maximumDrawingDimension && height <= maximumDrawingDimension; + } + + private void RestoreRegularPresentation() + { + presentationConfigured = false; + editorPresentationVisible = false; + SetRegularPresentationVisible(true); + HideLocalEditor(); + } + + private void HideLocalEditor() + { + if (localEditor == null) + localEditor = FindAnyObjectByType(FindObjectsInactive.Include); + + if (localEditor == null) + return; + + localEditor.DrawingSubmitted -= SubmitLocalDrawing; + localEditor.SetPermanentOpen(false); + localEditor.SetToggleButtonVisible(false); + localEditor.SetOpen(false); + + if (instantiatedLocalEditor) + Destroy(localEditor.gameObject); + else if (localEditorOriginalParent != null) + localEditor.transform.SetParent(localEditorOriginalParent, false); + + localEditor = null; + localEditorOriginalParent = null; + instantiatedLocalEditor = false; + + if (editorBackgroundCamera != null) + { + Destroy(editorBackgroundCamera); + editorBackgroundCamera = null; + } + } + + private void EnsureEditorBackgroundCamera() + { + if (editorBackgroundCamera != null) + return; + + editorBackgroundCamera = new GameObject("Paint Editor Background Camera"); + var backgroundCamera = editorBackgroundCamera.AddComponent(); + backgroundCamera.clearFlags = CameraClearFlags.SolidColor; + backgroundCamera.backgroundColor = new Color32(24, 27, 34, 255); + backgroundCamera.cullingMask = 0; + backgroundCamera.depth = -100f; + } + + private void SetRegularPresentationVisible(bool visible) + { + if (regularPresentationObjects == null) + return; + + foreach (var presentationObject in regularPresentationObjects) + { + if (presentationObject != null) + presentationObject.SetActive(visible); + } + } +} diff --git a/Assets/Scripts/NetworkWheelPaintSession.cs.meta b/Assets/Scripts/NetworkWheelPaintSession.cs.meta new file mode 100644 index 00000000..3e20826e --- /dev/null +++ b/Assets/Scripts/NetworkWheelPaintSession.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d2f46c24ea514036bef670247fb72897 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Networking.cs b/Assets/Scripts/Networking.cs new file mode 100644 index 00000000..08469ef8 --- /dev/null +++ b/Assets/Scripts/Networking.cs @@ -0,0 +1,306 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using PurrNet; +using PurrNet.Transports; +using UnityEngine; + +[Serializable] +public sealed class WheelDrawingUpload +{ + public uint submissionId; + public bool defendant; + public byte[] pngData; +} + +[Serializable] +public sealed class WheelDrawingChunk +{ + public uint submissionId; + public bool defendant; + public int totalBytes; + public int chunkIndex; + public int chunkCount; + public byte[] data; +} + +[Serializable] +public sealed class WheelDrawingReceipt +{ + public uint submissionId; + public bool accepted; +} + +/// +/// Scene-owned bridge between the PurrLobby-created NetworkManager and game systems. +/// Large wheel PNGs are split into small reliable messages so PurrTransport never +/// has to carry a multi-megabyte broadcast as one packet. +/// +[RegisterNetworkType(typeof(WheelDrawingChunk))] +[RegisterNetworkType(typeof(WheelDrawingReceipt))] +[DefaultExecutionOrder(-1100)] +[DisallowMultipleComponent] +public sealed class Networking : MonoBehaviour +{ + private const int ChunkPayloadBytes = 8 * 1024; + private const int MaximumDrawingBytes = 2 * 1024 * 1024; + private const int MaximumChunkCount = MaximumDrawingBytes / ChunkPayloadBytes + 1; + private const float IncompleteTransferLifetime = 15f; + + private sealed class IncomingDrawing + { + public bool defendant; + public int totalBytes; + public int chunkCount; + public byte[][] chunks; + public int receivedChunks; + public int receivedBytes; + public float lastTouched; + } + + public static Networking instance { get; private set; } + + public event Action drawingReceivedOnHost; + public event Action drawingReceiptReceived; + + private readonly Dictionary> incomingByPlayer = new(); + private NetworkManager manager; + private bool serverSubscribed; + private bool clientSubscribed; + private float nextCleanupTime; + + private void Awake() + { + if (instance != null && instance != this) + { + Debug.LogError("More than one Networking bridge exists in the game scene.", this); + enabled = false; + return; + } + + instance = this; + } + + private IEnumerator Start() + { + while (NetworkManager.main == null) + yield return null; + + manager = NetworkManager.main; + manager.RegisterEvents(OnNetworkStarted, OnNetworkStopped); + } + + private void Update() + { + if (!serverSubscribed || Time.unscaledTime < nextCleanupTime) + return; + + nextCleanupTime = Time.unscaledTime + 5f; + RemoveExpiredTransfers(); + } + + private void OnDestroy() + { + if (manager != null) + { + manager.UnregisterEvents(OnNetworkStarted, OnNetworkStopped); + RemoveServerSubscription(); + RemoveClientSubscription(); + } + + if (instance == this) + instance = null; + } + + public bool SendDrawingToHost(uint submissionId, bool defendant, byte[] pngData) + { + if (manager == null || !manager.isClient || manager.isServer || + submissionId == 0 || pngData == null || pngData.Length == 0 || + pngData.Length > MaximumDrawingBytes) + return false; + + int chunkCount = (pngData.Length + ChunkPayloadBytes - 1) / ChunkPayloadBytes; + for (int chunkIndex = 0; chunkIndex < chunkCount; chunkIndex++) + { + int sourceOffset = chunkIndex * ChunkPayloadBytes; + int payloadLength = Math.Min(ChunkPayloadBytes, pngData.Length - sourceOffset); + var payload = new byte[payloadLength]; + Buffer.BlockCopy(pngData, sourceOffset, payload, 0, payloadLength); + + manager.SendToServer(new WheelDrawingChunk + { + submissionId = submissionId, + defendant = defendant, + totalBytes = pngData.Length, + chunkIndex = chunkIndex, + chunkCount = chunkCount, + data = payload + }, Channel.ReliableOrdered); + } + + return true; + } + + public void SendDrawingReceipt(PlayerID player, uint submissionId, bool accepted) + { + if (manager == null || !manager.isServer) + return; + } + + manager.Send(player, new WheelDrawingReceipt + { + submissionId = submissionId, + accepted = accepted + }, Channel.ReliableOrdered); + } + + private void OnNetworkStarted(NetworkManager activeManager, bool asServer) + { + manager = activeManager; + + if (asServer && !serverSubscribed) + { + manager.Subscribe(OnDrawingChunkReceived, true); + serverSubscribed = true; + } + else if (!asServer && !clientSubscribed) + { + manager.Subscribe(OnDrawingReceiptReceived, false); + clientSubscribed = true; + } + } + + private void OnNetworkStopped(NetworkManager stoppedManager, bool asServer) + { + if (asServer) + RemoveServerSubscription(); + else + RemoveClientSubscription(); + } + + private void OnDrawingChunkReceived(PlayerID sender, WheelDrawingChunk chunk, bool asServer) + { + if (!asServer || !IsValidChunk(chunk)) + return; + + if (!incomingByPlayer.TryGetValue(sender, out var playerTransfers)) + { + playerTransfers = new Dictionary(); + incomingByPlayer.Add(sender, playerTransfers); + } + + if (!playerTransfers.TryGetValue(chunk.submissionId, out var incoming) || + incoming.defendant != chunk.defendant || incoming.totalBytes != chunk.totalBytes || + incoming.chunkCount != chunk.chunkCount) + { + incoming = new IncomingDrawing + { + defendant = chunk.defendant, + totalBytes = chunk.totalBytes, + chunkCount = chunk.chunkCount, + chunks = new byte[chunk.chunkCount][], + lastTouched = Time.unscaledTime + }; + playerTransfers[chunk.submissionId] = incoming; + } + + incoming.lastTouched = Time.unscaledTime; + if (incoming.chunks[chunk.chunkIndex] != null) + return; + + incoming.chunks[chunk.chunkIndex] = chunk.data; + incoming.receivedChunks++; + incoming.receivedBytes += chunk.data.Length; + + if (incoming.receivedChunks != incoming.chunkCount) + return; + + playerTransfers.Remove(chunk.submissionId); + if (incoming.receivedBytes != incoming.totalBytes) + { + SendDrawingReceipt(sender, chunk.submissionId, false); + return; + } + + var pngData = new byte[incoming.totalBytes]; + int destinationOffset = 0; + for (int i = 0; i < incoming.chunks.Length; i++) + { + var payload = incoming.chunks[i]; + Buffer.BlockCopy(payload, 0, pngData, destinationOffset, payload.Length); + destinationOffset += payload.Length; + } + + drawingReceivedOnHost?.Invoke(sender, new WheelDrawingUpload + { + submissionId = chunk.submissionId, + defendant = incoming.defendant, + pngData = pngData + }); + } + + private void OnDrawingReceiptReceived(PlayerID sender, WheelDrawingReceipt receipt, bool asServer) + { + if (!asServer && receipt != null) + drawingReceiptReceived?.Invoke(receipt); + } + + private static bool IsValidChunk(WheelDrawingChunk chunk) + { + if (chunk == null || chunk.submissionId == 0 || chunk.data == null || + chunk.totalBytes <= 0 || chunk.totalBytes > MaximumDrawingBytes || + chunk.chunkCount <= 0 || chunk.chunkCount > MaximumChunkCount || + chunk.chunkIndex < 0 || chunk.chunkIndex >= chunk.chunkCount || + chunk.data.Length <= 0 || chunk.data.Length > ChunkPayloadBytes) + return false; + + int expectedChunkCount = (chunk.totalBytes + ChunkPayloadBytes - 1) / ChunkPayloadBytes; + int expectedPayloadLength = chunk.chunkIndex == chunk.chunkCount - 1 + ? chunk.totalBytes - chunk.chunkIndex * ChunkPayloadBytes + : ChunkPayloadBytes; + return chunk.chunkCount == expectedChunkCount && chunk.data.Length == expectedPayloadLength; + } + + private void RemoveExpiredTransfers() + { + float cutoff = Time.unscaledTime - IncompleteTransferLifetime; + var emptyPlayers = new List(); + + foreach (var playerEntry in incomingByPlayer) + { + var expiredTransfers = new List(); + foreach (var transferEntry in playerEntry.Value) + { + if (transferEntry.Value.lastTouched < cutoff) + expiredTransfers.Add(transferEntry.Key); + } + + foreach (uint transferId in expiredTransfers) + playerEntry.Value.Remove(transferId); + if (playerEntry.Value.Count == 0) + emptyPlayers.Add(playerEntry.Key); + } + + foreach (var player in emptyPlayers) + incomingByPlayer.Remove(player); + } + + private void RemoveServerSubscription() + { + if (!serverSubscribed || manager == null) + return; + + serverSubscribed = false; + manager.Unsubscribe(OnDrawingChunkReceived, true); + incomingByPlayer.Clear(); + } + + private void RemoveClientSubscription() + { + if (!clientSubscribed || manager == null) + return; + + clientSubscribed = false; + manager.Unsubscribe(OnDrawingReceiptReceived, false); + } +} diff --git a/Assets/Scripts/Networking.cs.meta b/Assets/Scripts/Networking.cs.meta new file mode 100644 index 00000000..a576b6b5 --- /dev/null +++ b/Assets/Scripts/Networking.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: eebe6788196487a47bff27a2ea71eb78 \ No newline at end of file diff --git a/Assets/Scripts/PaintEditorCanvas.cs b/Assets/Scripts/PaintEditorCanvas.cs new file mode 100644 index 00000000..6c8bd5a3 --- /dev/null +++ b/Assets/Scripts/PaintEditorCanvas.cs @@ -0,0 +1,720 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.UI; + +[DisallowMultipleComponent] +[RequireComponent(typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster))] +public sealed class PaintEditorCanvas : MonoBehaviour +{ + /// + /// A network owner can consume the completed PNG here. Returning true prevents + /// the editor from installing a local-only wheel. + /// + public event Func DrawingSubmitted; + + private enum PaintTool + { + Pen, + Marker, + Eraser + } + + [Header("Canvas")] + [SerializeField, Min(128)] private int textureWidth = 1280; + [SerializeField, Min(128)] private int textureHeight = 720; + [SerializeField] private bool startOpen; + [SerializeField] private bool allowGuiToggle; + [SerializeField] private bool blackPenOnly; + + [Header("Default brush sizes")] + [SerializeField, Range(2, 64)] private int penSize = 8; + [SerializeField, Range(2, 64)] private int markerSize = 32; + [SerializeField, Range(2, 64)] private int eraserSize = 24; + + [Header("World drawing")] + [SerializeField] private Vector3 worldSpawnPosition = Vector3.zero; + [SerializeField, Min(1f)] private float worldPixelsPerUnit = 100f; + [SerializeField] private int worldSortingOrder = 10; + + private Canvas rootCanvas; + private GraphicRaycaster raycaster; + private RectTransform drawingRect; + private RawImage markerLayer; + private RawImage penLayer; + private Texture2D markerTexture; + private Texture2D penTexture; + private Color32[] markerPixels; + private Color32[] penPixels; + private Slider sizeSlider; + private Text sizeLabel; + private Text toolLabel; + + private PaintTool activeTool = PaintTool.Pen; + private Color32 activeColor = new(0, 0, 0, 255); + private Vector2Int previousPixel; + private bool drawing; + private bool permanentOpen; + private bool showToggleButton = true; + private readonly List> undoHistory = new(); + private List currentStroke; + private HashSet currentStrokeIndices; + + private static readonly Color32 Transparent = new(0, 0, 0, 0); + private static readonly Color32 MarkerAlpha = new(255, 255, 255, 90); + + /// + /// Invoked when the black-pen editor submits a cropped wheel PNG. Returning true + /// means the receiver accepted the drawing and replaces the legacy local spawn. + /// + public event Func DrawingSubmitted; + + private readonly struct PixelChange + { + public readonly int Index; + public readonly Color32 Marker; + public readonly Color32 Pen; + + public PixelChange(int index, Color32 marker, Color32 pen) + { + Index = index; + Marker = marker; + Pen = pen; + } + } + + private void Awake() + { + rootCanvas = GetComponent(); + raycaster = GetComponent(); + ConfigureFullscreenCanvas(); + BuildInterface(); + CreateDrawingTextures(); + SetOpen(startOpen); + SelectTool(PaintTool.Pen); + } + + private void OnDestroy() + { + if (markerTexture != null) + Destroy(markerTexture); + if (penTexture != null) + Destroy(penTexture); + } + + private void OnGUI() + { + if (permanentOpen || !showToggleButton) + return; + + var label = rootCanvas != null && rootCanvas.enabled ? "Close Paint" : "Open Paint"; + if (GUI.Button(new Rect(10f, 10f, 96f, 30f), label)) + SetOpen(rootCanvas == null || !rootCanvas.enabled); + } + + private void Update() + { + if (rootCanvas == null || !rootCanvas.enabled || drawingRect == null || Mouse.current == null) + return; + + var mouse = Mouse.current; + var screenPoint = mouse.position.ReadValue(); + var inside = TryGetPixel(screenPoint, out var pixel); + + if (mouse.leftButton.wasPressedThisFrame && inside) + { + BeginStroke(); + drawing = true; + previousPixel = pixel; + DrawLine(pixel, pixel); + } + else if (drawing && mouse.leftButton.isPressed && inside) + { + DrawLine(previousPixel, pixel); + previousPixel = pixel; + } + + if (mouse.leftButton.wasReleasedThisFrame) + { + drawing = false; + FinishStroke(); + } + } + + public void SetOpen(bool open) + { + if (permanentOpen && !open) + return; + + if (rootCanvas == null) + rootCanvas = GetComponent(); + if (raycaster == null) + raycaster = GetComponent(); + + if (!gameObject.activeSelf) + gameObject.SetActive(true); + ConfigureFullscreenCanvas(); + rootCanvas.enabled = open; + raycaster.enabled = open; + if (open) + Canvas.ForceUpdateCanvases(); + if (drawing) + FinishStroke(); + drawing = false; + } + + public void SetPermanentOpen(bool value) + { + permanentOpen = value; + if (value) + SetOpen(true); + } + + public void SetToggleButtonVisible(bool visible) + { + showToggleButton = visible; + } + + private void ConfigureFullscreenCanvas() + { + var rectTransform = (RectTransform)transform; + rectTransform.anchorMin = Vector2.zero; + rectTransform.anchorMax = Vector2.one; + rectTransform.anchoredPosition = Vector2.zero; + rectTransform.sizeDelta = Vector2.zero; + rectTransform.pivot = new Vector2(0.5f, 0.5f); + rectTransform.localRotation = Quaternion.identity; + rectTransform.localScale = Vector3.one; + + rootCanvas.renderMode = RenderMode.ScreenSpaceOverlay; + rootCanvas.overrideSorting = true; + rootCanvas.sortingOrder = 500; + } + + private void BuildInterface() + { + ConfigureFullscreenCanvas(); + + var scaler = GetComponent(); + scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize; + scaler.referenceResolution = new Vector2(1280f, 720f); + scaler.screenMatchMode = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight; + scaler.matchWidthOrHeight = 0.5f; + + var backdrop = CreateImage("Paint Editor", transform, new Color32(24, 27, 34, 255)); + Stretch(backdrop.rectTransform, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero); + + var toolbar = CreateImage("Toolbar", backdrop.transform, new Color32(42, 47, 58, 255)); + Stretch(toolbar.rectTransform, new Vector2(0f, 1f), Vector2.one, new Vector2(0f, -76f), Vector2.zero); + var layout = toolbar.gameObject.AddComponent(); + layout.padding = new RectOffset(12, 12, 10, 10); + layout.spacing = 8f; + layout.childAlignment = TextAnchor.MiddleLeft; + layout.childControlWidth = false; + layout.childControlHeight = true; + layout.childForceExpandWidth = false; + layout.childForceExpandHeight = true; + + CreateButton("Back", toolbar.transform, new Color32(75, 82, 99, 255), UndoLastStroke, 70f); + if (!blackPenOnly) + { + CreateButton("Pen", toolbar.transform, new Color32(75, 82, 99, 255), () => SelectTool(PaintTool.Pen), 62f); + CreateButton("Marker", toolbar.transform, new Color32(75, 82, 99, 255), () => SelectTool(PaintTool.Marker), 78f); + CreateButton("Eraser", toolbar.transform, new Color32(75, 82, 99, 255), () => SelectTool(PaintTool.Eraser), 76f); + + AddSpacer(toolbar.transform, 8f); + AddColorButton(toolbar.transform, "Black", Color.black); + AddColorButton(toolbar.transform, "Red", Color.red); + AddColorButton(toolbar.transform, "Blue", new Color32(30, 110, 255, 255)); + AddColorButton(toolbar.transform, "Green", new Color32(20, 185, 80, 255)); + AddColorButton(toolbar.transform, "Yellow", Color.yellow); + AddColorButton(toolbar.transform, "Purple", new Color32(155, 80, 220, 255)); + AddColorButton(toolbar.transform, "Orange", new Color32(255, 140, 25, 255)); + AddSpacer(toolbar.transform, 8f); + } + else + { + CreateButton("Submit Wheel", toolbar.transform, new Color32(46, 125, 88, 255), + () => CreateWorldDrawingGameObject(), 112f); + AddSpacer(toolbar.transform, 8f); + } + + sizeLabel = CreateLabel("Size: 8", toolbar.transform, 64f); + sizeSlider = CreateSlider(toolbar.transform); + sizeSlider.onValueChanged.AddListener(OnSizeChanged); + toolLabel = CreateLabel(blackPenOnly ? "Black Pen" : "Pen", toolbar.transform, blackPenOnly ? 100f : 70f); + + var surfaceFrame = CreateImage("Drawing Surface", backdrop.transform, new Color32(213, 216, 222, 255)); + Stretch(surfaceFrame.rectTransform, Vector2.zero, Vector2.one, new Vector2(14f, 14f), new Vector2(-14f, -90f)); + + var paper = CreateImage("Paper", surfaceFrame.transform, Color.white); + Stretch(paper.rectTransform, Vector2.zero, Vector2.one, new Vector2(3f, 3f), new Vector2(-3f, -3f)); + drawingRect = paper.rectTransform; + + markerLayer = CreateRawImage("Marker Layer", paper.transform); + Stretch(markerLayer.rectTransform, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero); + penLayer = CreateRawImage("Pen Layer", paper.transform); + Stretch(penLayer.rectTransform, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero); + } + + private void CreateDrawingTextures() + { + markerPixels = CreateTransparentPixels(); + penPixels = CreateTransparentPixels(); + markerTexture = CreateTransparentTexture("Paint Marker Layer", markerPixels); + penTexture = CreateTransparentTexture("Paint Pen Layer", penPixels); + markerLayer.texture = markerTexture; + penLayer.texture = penTexture; + } + + private Color32[] CreateTransparentPixels() + { + var pixels = new Color32[textureWidth * textureHeight]; + Array.Fill(pixels, Transparent); + return pixels; + } + + private Texture2D CreateTransparentTexture(string textureName, Color32[] pixels) + { + var texture = new Texture2D(textureWidth, textureHeight, TextureFormat.RGBA32, false) + { + name = textureName, + filterMode = FilterMode.Bilinear, + wrapMode = TextureWrapMode.Clamp + }; + texture.SetPixels32(pixels); + texture.Apply(false); + return texture; + } + + private bool TryGetPixel(Vector2 screenPoint, out Vector2Int pixel) + { + pixel = default; + if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(drawingRect, screenPoint, null, out var local)) + return false; + + var rect = drawingRect.rect; + if (!rect.Contains(local)) + return false; + + var u = Mathf.InverseLerp(rect.xMin, rect.xMax, local.x); + var v = Mathf.InverseLerp(rect.yMin, rect.yMax, local.y); + pixel = new Vector2Int( + Mathf.Clamp(Mathf.RoundToInt(u * (textureWidth - 1)), 0, textureWidth - 1), + Mathf.Clamp(Mathf.RoundToInt(v * (textureHeight - 1)), 0, textureHeight - 1)); + return true; + } + + private void DrawLine(Vector2Int from, Vector2Int to) + { + var distance = Mathf.Max(Mathf.Abs(to.x - from.x), Mathf.Abs(to.y - from.y)); + var steps = Mathf.Max(1, distance); + for (var i = 0; i <= steps; i++) + { + var t = i / (float)steps; + Stamp(Vector2Int.RoundToInt(Vector2.Lerp(from, to, t))); + } + + ApplyPixels(); + } + + private void Stamp(Vector2Int center) + { + var size = GetCurrentSize(); + var radius = Mathf.Max(1, size / 2); + var radiusSquared = radius * radius; + for (var y = -radius; y <= radius; y++) + for (var x = -radius; x <= radius; x++) + { + if (x * x + y * y > radiusSquared) + continue; + + var px = center.x + x; + var py = center.y + y; + if (px < 0 || py < 0 || px >= textureWidth || py >= textureHeight) + continue; + + var index = py * textureWidth + px; + RecordPixelBeforeChange(index); + + if (activeTool == PaintTool.Eraser) + { + markerPixels[index] = Transparent; + penPixels[index] = Transparent; + } + else if (activeTool == PaintTool.Marker) + { + var markerColor = activeColor; + markerColor.a = MarkerAlpha.a; + markerPixels[index] = markerColor; + } + else + { + penPixels[index] = activeColor; + } + } + } + + private void BeginStroke() + { + currentStroke = new List(); + currentStrokeIndices = new HashSet(); + } + + private void RecordPixelBeforeChange(int index) + { + if (currentStrokeIndices == null || !currentStrokeIndices.Add(index)) + return; + + currentStroke.Add(new PixelChange(index, markerPixels[index], penPixels[index])); + } + + private void FinishStroke() + { + if (currentStroke is { Count: > 0 }) + { + undoHistory.Add(currentStroke); + if (undoHistory.Count > 30) + undoHistory.RemoveAt(0); + } + + currentStroke = null; + currentStrokeIndices = null; + } + + private void UndoLastStroke() + { + if (drawing) + { + drawing = false; + FinishStroke(); + } + + if (undoHistory.Count == 0) + return; + + var lastIndex = undoHistory.Count - 1; + var stroke = undoHistory[lastIndex]; + undoHistory.RemoveAt(lastIndex); + foreach (var change in stroke) + { + markerPixels[change.Index] = change.Marker; + penPixels[change.Index] = change.Pen; + } + ApplyPixels(); + } + + private void ApplyPixels() + { + markerTexture.SetPixels32(markerPixels); + penTexture.SetPixels32(penPixels); + markerTexture.Apply(false); + penTexture.Apply(false); + } + + /// + /// Creates the drawn black-pen layer as a new world-space GameObject. + /// Other scripts can call this method directly and use the returned object. + /// + public GameObject CreateWorldDrawingGameObject() + { + if (!TryGetVisiblePenBounds(out var penBounds)) + { + Debug.LogWarning("Draw something before creating a world object.", this); + return null; + } + + const int transparentPadding = 2; + var croppedWidth = penBounds.width + transparentPadding * 2; + var croppedHeight = penBounds.height + transparentPadding * 2; + var croppedPixels = new Color32[croppedWidth * croppedHeight]; + Array.Fill(croppedPixels, Transparent); + for (var y = 0; y < penBounds.height; y++) + for (var x = 0; x < penBounds.width; x++) + { + var sourceIndex = (penBounds.yMin + y) * textureWidth + penBounds.xMin + x; + var destinationIndex = (y + transparentPadding) * croppedWidth + x + transparentPadding; + croppedPixels[destinationIndex] = penPixels[sourceIndex]; + } + + var worldTexture = new Texture2D(croppedWidth, croppedHeight, TextureFormat.RGBA32, false) + { + name = "Black Pen Drawing Texture", + filterMode = FilterMode.Bilinear, + wrapMode = TextureWrapMode.Clamp + }; + worldTexture.SetPixels32(croppedPixels); + worldTexture.Apply(false); + + if (TrySubmitDrawing(worldTexture.EncodeToPNG())) + { + Destroy(worldTexture); + ClearDrawing(); + return null; + } + + // This is the point where the legacy local world GameObject is created. + var worldDrawing = new GameObject("Black Pen Drawing"); + worldDrawing.transform.position = worldSpawnPosition; + + var sprite = Sprite.Create( + worldTexture, + new Rect(0f, 0f, croppedWidth, croppedHeight), + new Vector2(0.5f, 0.5f), + worldPixelsPerUnit, + 0, + SpriteMeshType.Tight, + Vector4.zero, + true); + sprite.name = "Black Pen Drawing Sprite"; + + var spriteRenderer = worldDrawing.AddComponent(); + spriteRenderer.sprite = sprite; + spriteRenderer.sortingOrder = worldSortingOrder; + + var polygonCollider = worldDrawing.AddComponent(); + CopySpritePhysicsShape(sprite, polygonCollider); + worldDrawing.AddComponent(); + + var drawingPng = worldTexture.EncodeToPNG(); + if (DrawingSubmitted != null && DrawingSubmitted.Invoke(drawingPng)) + { + Destroy(worldDrawing); + SetOpen(false); + return null; + } + + // MainGame's car claims this object here and turns it into its next wheel. + CarDrawingWheelInstaller.TryInstallDrawing(worldDrawing); + SetOpen(false); + + return worldDrawing; + } + + private bool TrySubmitDrawing(byte[] pngData) + { + if (DrawingSubmitted == null) + return false; + + var accepted = false; + foreach (var callback in DrawingSubmitted.GetInvocationList()) + { + if (callback is not Func handler) + continue; + + try + { + accepted |= handler(pngData); + } + catch (Exception exception) + { + Debug.LogException(exception, this); + } + } + + return accepted; + } + + private void ClearDrawing() + { + Array.Fill(markerPixels, Transparent); + Array.Fill(penPixels, Transparent); + undoHistory.Clear(); + currentStroke = null; + currentStrokeIndices = null; + drawing = false; + ApplyPixels(); + } + + private bool TryGetVisiblePenBounds(out RectInt bounds) + { + bounds = default; + if (penPixels == null || penPixels.Length == 0) + return false; + + var minX = textureWidth; + var minY = textureHeight; + var maxX = -1; + var maxY = -1; + for (var y = 0; y < textureHeight; y++) + for (var x = 0; x < textureWidth; x++) + { + if (penPixels[y * textureWidth + x].a == 0) + continue; + + minX = Mathf.Min(minX, x); + minY = Mathf.Min(minY, y); + maxX = Mathf.Max(maxX, x); + maxY = Mathf.Max(maxY, y); + } + + if (maxX < minX || maxY < minY) + return false; + + bounds = new RectInt(minX, minY, maxX - minX + 1, maxY - minY + 1); + return true; + } + + private static void CopySpritePhysicsShape(Sprite sprite, PolygonCollider2D polygonCollider) + { + var shapeCount = sprite.GetPhysicsShapeCount(); + if (shapeCount == 0) + { + polygonCollider.enabled = false; + Debug.LogWarning("Unity could not generate a polygon outline for this drawing.", polygonCollider); + return; + } + + polygonCollider.pathCount = shapeCount; + var points = new List(); + for (var pathIndex = 0; pathIndex < shapeCount; pathIndex++) + { + points.Clear(); + sprite.GetPhysicsShape(pathIndex, points); + polygonCollider.SetPath(pathIndex, points); + } + } + + private void SelectTool(PaintTool tool) + { + activeTool = tool; + if (toolLabel != null) + toolLabel.text = blackPenOnly ? "Black Pen" : tool.ToString(); + if (sizeSlider != null) + sizeSlider.SetValueWithoutNotify(GetCurrentSize()); + UpdateSizeLabel(); + } + + private void SelectColor(Color32 color) + { + activeColor = color; + if (activeTool == PaintTool.Eraser) + SelectTool(PaintTool.Pen); + } + + private void OnSizeChanged(float value) + { + var size = Mathf.RoundToInt(value); + switch (activeTool) + { + case PaintTool.Marker: markerSize = size; break; + case PaintTool.Eraser: eraserSize = size; break; + default: penSize = size; break; + } + UpdateSizeLabel(); + } + + private int GetCurrentSize() => activeTool switch + { + PaintTool.Marker => markerSize, + PaintTool.Eraser => eraserSize, + _ => penSize + }; + + private void UpdateSizeLabel() + { + if (sizeLabel != null) + sizeLabel.text = $"Size: {GetCurrentSize()}"; + } + + private void AddColorButton(Transform parent, string label, Color32 color) + { + var textColor = color.r + color.g + color.b > 500 ? Color.black : Color.white; + CreateButton(label, parent, color, () => SelectColor(color), 64f, textColor); + } + + private static Button CreateButton(string label, Transform parent, Color color, UnityEngine.Events.UnityAction action, + float width, Color? textColor = null) + { + var image = CreateImage(label, parent, color); + image.gameObject.AddComponent().preferredWidth = width; + var button = image.gameObject.AddComponent